github.com/scaleway/scaleway-cli@v1.11.1/pkg/commands/version_test.go (about) 1 // Copyright (C) 2015 Scaleway. All rights reserved. 2 // Use of this source code is governed by a MIT-style 3 // license that can be found in the LICENSE.md file. 4 5 package commands 6 7 import ( 8 "bytes" 9 "testing" 10 11 . "github.com/smartystreets/goconvey/convey" 12 ) 13 14 func TestVersion(t *testing.T) { 15 Convey("Testing Version()", t, func() { 16 ctx := testCommandContext() 17 var buf bytes.Buffer 18 ctx.Stdout = &buf 19 20 args := VersionArgs{} 21 22 err := Version(ctx, args) 23 24 So(err, ShouldBeNil) 25 So(buf.String(), ShouldContainSubstring, "Client version: ") 26 So(buf.String(), ShouldContainSubstring, "Go version (client): ") 27 So(buf.String(), ShouldContainSubstring, "Git commit (client): ") 28 So(buf.String(), ShouldContainSubstring, "OS/Arch (client): ") 29 30 }) 31 } 32 33 func ExampleVersion() { 34 ctx := testCommandContext() 35 args := VersionArgs{} 36 Version(ctx, args) 37 }