зеркало из https://github.com/microsoft/docker.git
30 строки
673 B
Go
30 строки
673 B
Go
package 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())
|
|
}
|