MCPcopy Index your code
hub / github.com/pocketbase/pocketbase / TestScan

Function TestScan

tools/tokenizer/tokenizer_test.go:66–90  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

64}
65
66func TestScan(t *testing.T) {
67 tk := NewFromString("abc, 123.456, (abc)")
68
69 expectedTokens := []string{"abc", "123.456", "(abc)"}
70
71 for _, token := range expectedTokens {
72 result, err := tk.Scan()
73 if err != nil {
74 t.Fatalf("Expected token %q, got error %v", token, err)
75 }
76
77 if result != token {
78 t.Fatalf("Expected token %q, got error %v", token, result)
79 }
80 }
81
82 // scan the last character
83 token, err := tk.Scan()
84 if err != io.EOF {
85 t.Fatalf("Expected EOF error, got %v", err)
86 }
87 if token != "" || err != io.EOF {
88 t.Fatalf("Expected empty token, got %q", token)
89 }
90}
91
92func TestScanAll(t *testing.T) {
93 scenarios := []struct {

Callers

nothing calls this directly

Calls 2

NewFromStringFunction · 0.85
ScanMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…