MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestDollarQuotedString_Basic

Function TestDollarQuotedString_Basic

pkg/sql/tokenizer/dollar_quote_test.go:23–44  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21)
22
23func TestDollarQuotedString_Basic(t *testing.T) {
24 tkz, err := New()
25 if err != nil {
26 t.Fatal(err)
27 }
28
29 tokens, err := tkz.Tokenize([]byte(`$$hello$$`))
30 if err != nil {
31 t.Fatalf("unexpected error: %v", err)
32 }
33
34 // Should be: DollarQuotedString("hello"), EOF
35 if len(tokens) != 2 {
36 t.Fatalf("expected 2 tokens, got %d", len(tokens))
37 }
38 if tokens[0].Token.Type != models.TokenTypeDollarQuotedString {
39 t.Errorf("expected DollarQuotedString, got %v", tokens[0].Token.Type)
40 }
41 if tokens[0].Token.Value != "hello" {
42 t.Errorf("expected 'hello', got %q", tokens[0].Token.Value)
43 }
44}
45
46func TestDollarQuotedString_NamedTag(t *testing.T) {
47 tkz, _ := New()

Callers

nothing calls this directly

Calls 4

TokenizeMethod · 0.80
NewFunction · 0.70
FatalfMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected