From 508549128d21d752cb861ac2d65bc8fc89e32555 Mon Sep 17 00:00:00 2001 From: bpc2003 Date: Mon, 26 May 2025 21:41:51 -0400 Subject: Added external commands --- cmds/test.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'cmds/test.go') 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 { -- cgit v1.2.3