mirror of
https://github.com/Direct-Dev-Ru/go-lcg.git
synced 2025-11-16 01:29:55 +00:00
34 lines
671 B
Go
34 lines
671 B
Go
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)
|
|
}
|
|
}
|
|
}
|