reg/vendor/github.com/docker/cli/opts/quotedstring_test.go
Jess Frazelle 7b8945c124
update deps
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
2018-03-11 11:52:12 -04:00

31 lines
787 B
Go

package opts
import (
"testing"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
)
func TestQuotedStringSetWithQuotes(t *testing.T) {
value := ""
qs := NewQuotedString(&value)
assert.NilError(t, qs.Set(`"something"`))
assert.Check(t, is.Equal("something", qs.String()))
assert.Check(t, is.Equal("something", value))
}
func TestQuotedStringSetWithMismatchedQuotes(t *testing.T) {
value := ""
qs := NewQuotedString(&value)
assert.NilError(t, qs.Set(`"something'`))
assert.Check(t, is.Equal(`"something'`, qs.String()))
}
func TestQuotedStringSetWithNoQuotes(t *testing.T) {
value := ""
qs := NewQuotedString(&value)
assert.NilError(t, qs.Set("something"))
assert.Check(t, is.Equal("something", qs.String()))
}