35 lines
510 B
Go
35 lines
510 B
Go
|
package command_test
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"go-mod.ewintr.nl/planner/plan/command"
|
||
|
)
|
||
|
|
||
|
func TestFlagString(t *testing.T) {
|
||
|
t.Parallel()
|
||
|
|
||
|
valid := "test"
|
||
|
f := command.FlagString{}
|
||
|
if f.IsSet() {
|
||
|
t.Errorf("exp false, gor true")
|
||
|
}
|
||
|
|
||
|
if err := f.Set(valid); err != nil {
|
||
|
t.Errorf("exp nil, got %v", err)
|
||
|
}
|
||
|
|
||
|
if !f.IsSet() {
|
||
|
t.Errorf("exp true, got false")
|
||
|
}
|
||
|
|
||
|
act, ok := f.Get().(string)
|
||
|
if !ok {
|
||
|
t.Errorf("exp true, got false")
|
||
|
}
|
||
|
if act != valid {
|
||
|
t.Errorf("exp %v, got %v", valid, act)
|
||
|
}
|
||
|
|
||
|
}
|