aboutsummaryrefslogtreecommitdiff
path: root/scanners_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'scanners_test.go')
-rw-r--r--scanners_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/scanners_test.go b/scanners_test.go
index cab697e..851d284 100644
--- a/scanners_test.go
+++ b/scanners_test.go
@@ -51,3 +51,25 @@ func TestScanAlphaNum(t *testing.T) {
}
}
}
+
+func TestScanQuotedString(t *testing.T) {
+ testCases := []struct {
+ Input string
+ Expected bool
+ Pos int
+ }{
+ {`asd`, false, 0},
+ {`"asd`, false, 0},
+ {`"asd"qwe`, true, 5},
+ }
+ for _, tc := range testCases {
+ l := New(tc.Input)
+ actual := ScanQuotedString(l, '"')
+ if actual != tc.Expected {
+ t.Errorf("Input: %s expected scan result: %v actual: %v", tc.Input, tc.Expected, actual)
+ }
+ if l.Pos != tc.Pos {
+ t.Errorf("Input: %s expected scan position: %d actual: %d", tc.Input, tc.Pos, l.Pos)
+ }
+ }
+}