| 21 | ) |
| 22 | |
| 23 | func 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 | |
| 46 | func TestDollarQuotedString_NamedTag(t *testing.T) { |
| 47 | tkz, _ := New() |