045e9834a5
Signed-off-by: Daniel Nephin <dnephin@docker.com>
(cherry picked from commit abe32de6b4
)
Signed-off-by: Victor Vieux <vieux@docker.com>
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
28 lines
689 B
Go
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")
|
|
}
|