diff options
Diffstat (limited to 'cmds/test.go')
-rw-r--r-- | cmds/test.go | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/cmds/test.go b/cmds/test.go index 59989d3..f952384 100644 --- a/cmds/test.go +++ b/cmds/test.go @@ -8,7 +8,7 @@ import ( "syscall" ) -func test(args []string) int { +func Test(args []string) int { if len(args) <= 2 { return 1 } @@ -16,6 +16,9 @@ func test(args []string) int { if strings.HasPrefix(args[1], "-") { return genTest(args[1:]) } else { + if len(args) != 4 { + return 1 + } _, err := strconv.Atoi(args[1]) if err != nil { return testString(args[1:]) @@ -26,9 +29,6 @@ func test(args []string) int { } func testString(args []string) int { - if len(args) != 3 { - return 1 - } sTests := map[string]func() bool{ "=": func() bool { return args[0] == args[2] }, "!=": func() bool { return args[0] != args[2] }, @@ -42,9 +42,6 @@ func testString(args []string) int { } func testNumber(args []string) int { - if len(args) != 3 { - return 1 - } a, _ := strconv.Atoi(args[0]) b, err := strconv.Atoi(args[2]) if err != nil { |