diff options
author | bpc2003 <wpesfriendnva@gmail.com> | 2025-05-27 13:16:32 -0400 |
---|---|---|
committer | bpc2003 <wpesfriendnva@gmail.com> | 2025-05-27 13:16:32 -0400 |
commit | 54545ca337ee803ceb7d7e25a05e929dca2cd856 (patch) | |
tree | f528d3d30335fbc00f8a5e6b0d2949f12b3d39e9 /cmds/test.go | |
parent | 0d174f9cf1f1e3aab6ca809c175027516645d05e (diff) |
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 } } } |