mirror of
https://github.com/genuinetools/reg.git
synced 2024-08-21 06:10:23 -04:00
30 lines
673 B
Go
30 lines
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())
|
||
|
}
|