mirror of
https://github.com/on4kjm/FLEcli.git
synced 2025-02-20 13:27:23 +01:00
testing unit tests
This commit is contained in:
parent
ee565dd24c
commit
6ff7672658
1 changed files with 30 additions and 0 deletions
30
cmd/callsign_test.go
Normal file
30
cmd/callsign_test.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
package cmd
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestValidateCall(t *testing.T) {
|
||||
type args struct {
|
||||
sign string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
//args string
|
||||
wantCall string
|
||||
wantErrorMsg string
|
||||
}{
|
||||
{"Good call (simple)", args.String("on4kjm"), "ON4KJM", ""},
|
||||
{"Good call (suffix)", "on4kjm/p", "ON4KJM/P", ""},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
gotCall, gotErrorMsg := ValidateCall(tt.args.sign)
|
||||
if gotCall != tt.wantCall {
|
||||
t.Errorf("ValidateCall() gotCall = %v, want %v", gotCall, tt.wantCall)
|
||||
}
|
||||
if gotErrorMsg != tt.wantErrorMsg {
|
||||
t.Errorf("ValidateCall() gotErrorMsg = %v, want %v", gotErrorMsg, tt.wantErrorMsg)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue