Hello.
First of all, thanks for making a great tool.
By the way, I want to add cli_test.go.
Perhaps a different name might be better.
This file actually execute main.go and tests its standard output.
If you give permission I would like to write this test.
How about?
cli_test example
package main
import (
"bytes"
"fmt"
"strings"
"testing"
)
func TestRun_versionFlag(t *testing.T) {
outStream, errStream := new(bytes.Buffer), new(bytes.Buffer)
cli := &CLIoutStream: outStream, errStream: errStream
args := strings.Split("skm -version", " ")
status := cli.Run(args)
if status != ExitCodeOK
t.Errorf("ExitStatus=%d, want %d", status, ExitCodeOK)
}
expected := fmt.Sprintf("skm version %s", Version)
if !strings.Contains(errStream.String(), expected)
t.Errorf("Output=%q, want %q", errStream.String(), expected)
}
}
Hello. First of all, thanks for making a great tool. By the way, I want to add
cli_test.go
. Perhaps a different name might be better. This file actually executemain.go
and tests its standard output.If you give permission I would like to write this test. How about?
cli_test example