1
0
mirror of https://github.com/docker/cli.git synced 2025-08-30 12:01:10 +03:00
Files
cli/opts/quotedstring_test.go
Vincent Demeester 2c4de4fb5e Update tests to use gotest.tools 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-08 18:24:26 +02:00

31 lines
731 B
Go

package opts
import (
"testing"
"gotest.tools/assert"
is "gotest.tools/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()))
}