aboutsummaryrefslogtreecommitdiff
path: root/scanners_test.go
diff options
context:
space:
mode:
authorAlexander Kiryukhin <a.kiryukhin@mail.ru>2021-03-07 01:32:29 +0300
committerAlexander Kiryukhin <a.kiryukhin@mail.ru>2021-03-07 01:32:29 +0300
commit3e6a54d506fb5c18ae0aec8cfe01578b40edbc9b (patch)
tree9bd63c59e7c772bfaac93e40e58b84150fd04fd3 /scanners_test.go
parentdf3a032c5268f002b84a1f9d52bfdc384d58fc98 (diff)
Added quoted string scannerv0.0.1
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)
+ }
+ }
+}