surtur
4b6e655ebf
All checks were successful
continuous-integration/drone/push Build is passing
* add 'version' command - "go-xkcdreader version" returns a formatted version of the app * test (among other things) that the version in flake.nix matches the version hardcoded in app's go code (cmd/version.go)
29 lines
444 B
Go
29 lines
444 B
Go
package cmd
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestGetAppName(t *testing.T) {
|
|
want := "go-xkcdreader"
|
|
got := GetAppName()
|
|
|
|
if got != want {
|
|
t.Errorf("App name strings don't match, want: %q', got: %q ", want, got)
|
|
}
|
|
}
|
|
|
|
func TestExecuteRootCmd(t *testing.T) {
|
|
rootcmd := *Root
|
|
|
|
err := rootcmd.Execute()
|
|
if err != nil {
|
|
t.Error("Failed to execute the root cmd")
|
|
}
|
|
}
|
|
|
|
// is this valid? dunno
|
|
func TestExecuteFunc(t *testing.T) {
|
|
Execute()
|
|
}
|