diff options
Diffstat (limited to 'cmds/test.go')
-rw-r--r-- | cmds/test.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/cmds/test.go b/cmds/test.go index f952384..efe4d97 100644 --- a/cmds/test.go +++ b/cmds/test.go @@ -1,6 +1,7 @@ package cmds import ( + "errors" "os" "os/user" "strconv" @@ -8,22 +9,22 @@ import ( "syscall" ) -func Test(args []string) int { +func Test(args []string) (int, error) { if len(args) <= 2 { - return 1 + return 1, errors.New("test requires at least two arguments") } if strings.HasPrefix(args[1], "-") { - return genTest(args[1:]) + return genTest(args[1:]), nil } else { if len(args) != 4 { - return 1 + return 1, nil } _, err := strconv.Atoi(args[1]) if err != nil { - return testString(args[1:]) + return testString(args[1:]), nil } else { - return testNumber(args[1:]) + return testNumber(args[1:]), nil } } } |