mirror of
https://github.com/genuinetools/reg.git
synced 2024-08-21 14:20:23 -04:00
30 lines
715 B
Go
30 lines
715 B
Go
package opts // import "github.com/docker/docker/opts"
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestQuotedStringSetWithQuotes(t *testing.T) {
|
|
value := ""
|
|
qs := NewQuotedString(&value)
|
|
assert.NoError(t, qs.Set(`"something"`))
|
|
assert.Equal(t, "something", qs.String())
|
|
assert.Equal(t, "something", value)
|
|
}
|
|
|
|
func TestQuotedStringSetWithMismatchedQuotes(t *testing.T) {
|
|
value := ""
|
|
qs := NewQuotedString(&value)
|
|
assert.NoError(t, qs.Set(`"something'`))
|
|
assert.Equal(t, `"something'`, qs.String())
|
|
}
|
|
|
|
func TestQuotedStringSetWithNoQuotes(t *testing.T) {
|
|
value := ""
|
|
qs := NewQuotedString(&value)
|
|
assert.NoError(t, qs.Set("something"))
|
|
assert.Equal(t, "something", qs.String())
|
|
}
|