Test that a quote inside a selector is a name's text, not a layout's quote
This commit is contained in:
@@ -2,6 +2,7 @@ package fejkdata
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -379,3 +380,18 @@ func TestArgErrorsNameTheSpelling(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestSplitArgsQuotesOutsideSelectors pins the arg grammar: a comma splits outside a
|
||||
// selector and outside a quoted layout, and a quote inside a selector is a name's text.
|
||||
func TestSplitArgsQuotesOutsideSelectors(t *testing.T) {
|
||||
for in, want := range map[string][]string{
|
||||
"a, b": {"a", "b"},
|
||||
"1990-01-01,1990-12-31,'January 2, 2006'": {"1990-01-01", "1990-12-31", "'January 2, 2006'"},
|
||||
"/geo.US.locality[O'Fallon].name, 2": {"/geo.US.locality[O'Fallon].name", "2"},
|
||||
"'[a,b]'": {"'[a,b]'"},
|
||||
} {
|
||||
if got := splitArgs(in); !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("splitArgs(%q) = %q, want %q", in, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user