5bbef3b47e
This reverts commit 17be40a73310e1a0d2461b175f6214381ac41039.
34 lines
583 B
Go
34 lines
583 B
Go
package agent
|
|
|
|
import (
|
|
"flag"
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestAppendSliceValue_implements(t *testing.T) {
|
|
var raw interface{}
|
|
raw = new(AppendSliceValue)
|
|
if _, ok := raw.(flag.Value); !ok {
|
|
t.Fatalf("AppendSliceValue should be a Value")
|
|
}
|
|
}
|
|
|
|
func TestAppendSliceValueSet(t *testing.T) {
|
|
sv := new(AppendSliceValue)
|
|
err := sv.Set("foo")
|
|
if err != nil {
|
|
t.Fatalf("err: %s", err)
|
|
}
|
|
|
|
err = sv.Set("bar")
|
|
if err != nil {
|
|
t.Fatalf("err: %s", err)
|
|
}
|
|
|
|
expected := []string{"foo", "bar"}
|
|
if !reflect.DeepEqual([]string(*sv), expected) {
|
|
t.Fatalf("Bad: %#v", sv)
|
|
}
|
|
}
|