INNER CODE UNIT · Go

TestShowUsage

cristianoliveira/ergo · main_test.go:49

func TestShowUsage(t *testing.T) {
	t.Run("when missing a command", func(tt *testing.T) {
		args := []string{"ergo"}
		os.Args = args

		result, config := prepareSubCommand(args)
		if result != nil || config != nil {
			t.Errorf("Expected result to not be nil got %s and %v", result, config)
		}
	})

	t.Run("when wrong unknown command", func(tt *testing.T) {
		args := []string{"ergo", "foobar"}
		os.Args = args

		result, config := prepareSubCommand(args)
		if result != nil || config != nil {
			t.Errorf("Expected result to not be nil got %s and %v", result, config)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…