mirror of
https://github.com/Direct-Dev-Ru/go-lcg.git
synced 2025-11-16 01:29:55 +00:00
first commit
This commit is contained in:
33
main_test.go
Normal file
33
main_test.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHandleCommand(t *testing.T) {
|
||||
tests := []struct {
|
||||
command string
|
||||
expected int
|
||||
}{
|
||||
{"", CMD_HELP},
|
||||
{"--help", CMD_HELP},
|
||||
{"-h", CMD_HELP},
|
||||
{"--version", CMD_VERSION},
|
||||
{"-v", CMD_VERSION},
|
||||
{"--update-key", CMD_UPDATE},
|
||||
{"-u", CMD_UPDATE},
|
||||
{"--delete-key", CMD_DELETE},
|
||||
{"-d", CMD_DELETE},
|
||||
{"random strings", CMD_COMPLETION},
|
||||
{"--test", CMD_COMPLETION},
|
||||
{"-test", CMD_COMPLETION},
|
||||
{"how to extract test.tar.gz", CMD_COMPLETION},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
result := handleCommand(test.command)
|
||||
if result != test.expected {
|
||||
t.Error("Expected", test.expected, "got", result)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user