1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/opts/quotedstring_test.go
Daniel Nephin abe32de6b4 Trim quotes from TLS flags.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-03 15:58:41 -05:00

28 lines
689 B
Go

package opts
import (
"github.com/docker/docker/pkg/testutil/assert"
"testing"
)
func TestQuotedStringSetWithQuotes(t *testing.T) {
value := ""
qs := NewQuotedString(&value)
assert.NilError(t, qs.Set("\"something\""))
assert.Equal(t, qs.String(), "something")
assert.Equal(t, value, "something")
}
func TestQuotedStringSetWithMismatchedQuotes(t *testing.T) {
value := ""
qs := NewQuotedString(&value)
assert.NilError(t, qs.Set("\"something'"))
assert.Equal(t, qs.String(), "\"something'")
}
func TestQuotedStringSetWithNoQuotes(t *testing.T) {
value := ""
qs := NewQuotedString(&value)
assert.NilError(t, qs.Set("something"))
assert.Equal(t, qs.String(), "something")
}