(t *testing.T)
| 47 | } |
| 48 | |
| 49 | func TestTSQL_TempTableIdentifiers(t *testing.T) { |
| 50 | tkz := newSQLServerTokenizer(t) |
| 51 | |
| 52 | tests := []struct { |
| 53 | name string |
| 54 | input string |
| 55 | want string |
| 56 | }{ |
| 57 | {"local temp table", "#temp", "#temp"}, |
| 58 | {"global temp table", "##global_temp", "##global_temp"}, |
| 59 | {"temp table in SELECT", "SELECT * FROM #orders", "#orders"}, |
| 60 | } |
| 61 | |
| 62 | for _, tt := range tests { |
| 63 | t.Run(tt.name, func(t *testing.T) { |
| 64 | tokens := tokenize(t, tkz, tt.input) |
| 65 | // Find the identifier token with # prefix |
| 66 | found := false |
| 67 | for _, tok := range tokens { |
| 68 | if tok.Token.Value == tt.want { |
| 69 | if tok.Token.Type != models.TokenTypeIdentifier { |
| 70 | t.Errorf("expected TokenTypeIdentifier for %q, got %v", tt.want, tok.Token.Type) |
| 71 | } |
| 72 | found = true |
| 73 | break |
| 74 | } |
| 75 | } |
| 76 | if !found { |
| 77 | t.Errorf("did not find token with value %q in tokens:", tt.want) |
| 78 | for i, tok := range tokens { |
| 79 | t.Logf(" [%d] type=%v value=%q", i, tok.Token.Type, tok.Token.Value) |
| 80 | } |
| 81 | } |
| 82 | }) |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | func TestTSQL_TempTableStandaloneHash(t *testing.T) { |
| 87 | // In SQL Server dialect, a standalone # (not followed by identifier) should still be TokenTypeSharp |
nothing calls this directly
no test coverage detected