7a5c8dc1eb
* copyright headers for agent folder * Ignore test data files * fix proto files and remove headers in agent/uiserver folder * ignore deep-copy files * copyright headers for agent folder * Copyright headers for command folder * fix merge conflicts
39 lines
681 B
Go
39 lines
681 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package flags
|
|
|
|
import (
|
|
"flag"
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestAppendSliceValue_implements(t *testing.T) {
|
|
t.Parallel()
|
|
var raw interface{}
|
|
raw = new(AppendSliceValue)
|
|
if _, ok := raw.(flag.Value); !ok {
|
|
t.Fatalf("AppendSliceValue should be a Value")
|
|
}
|
|
}
|
|
|
|
func TestAppendSliceValueSet(t *testing.T) {
|
|
t.Parallel()
|
|
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)
|
|
}
|
|
}
|