github.com/ssdev-go/moby@v17.12.1-ce-rc2+incompatible/opts/quotedstring_test.go (about) 1 package opts 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func TestQuotedStringSetWithQuotes(t *testing.T) { 10 value := "" 11 qs := NewQuotedString(&value) 12 assert.NoError(t, qs.Set(`"something"`)) 13 assert.Equal(t, "something", qs.String()) 14 assert.Equal(t, "something", value) 15 } 16 17 func TestQuotedStringSetWithMismatchedQuotes(t *testing.T) { 18 value := "" 19 qs := NewQuotedString(&value) 20 assert.NoError(t, qs.Set(`"something'`)) 21 assert.Equal(t, `"something'`, qs.String()) 22 } 23 24 func TestQuotedStringSetWithNoQuotes(t *testing.T) { 25 value := "" 26 qs := NewQuotedString(&value) 27 assert.NoError(t, qs.Set("something")) 28 assert.Equal(t, "something", qs.String()) 29 }