(t *testing.T)
| 112 | } |
| 113 | |
| 114 | func TestTSQL_GlobalVariables(t *testing.T) { |
| 115 | tkz := newSQLServerTokenizer(t) |
| 116 | |
| 117 | tests := []struct { |
| 118 | name string |
| 119 | input string |
| 120 | want string |
| 121 | }{ |
| 122 | {"@@ROWCOUNT", "@@ROWCOUNT", "@@ROWCOUNT"}, |
| 123 | {"@@IDENTITY", "@@IDENTITY", "@@IDENTITY"}, |
| 124 | {"@@ERROR", "SELECT @@ERROR", "@@ERROR"}, |
| 125 | {"@@VERSION", "@@VERSION", "@@VERSION"}, |
| 126 | } |
| 127 | |
| 128 | for _, tt := range tests { |
| 129 | t.Run(tt.name, func(t *testing.T) { |
| 130 | tokens := tokenize(t, tkz, tt.input) |
| 131 | found := false |
| 132 | for _, tok := range tokens { |
| 133 | if tok.Token.Value == tt.want { |
| 134 | if tok.Token.Type != models.TokenTypeIdentifier { |
| 135 | t.Errorf("expected TokenTypeIdentifier for %q, got %v", tt.want, tok.Token.Type) |
| 136 | } |
| 137 | found = true |
| 138 | break |
| 139 | } |
| 140 | } |
| 141 | if !found { |
| 142 | t.Errorf("did not find token with value %q in tokens:", tt.want) |
| 143 | for i, tok := range tokens { |
| 144 | t.Logf(" [%d] type=%v value=%q", i, tok.Token.Type, tok.Token.Value) |
| 145 | } |
| 146 | } |
| 147 | }) |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | func TestTSQL_AtAtStillWorksInPostgreSQL(t *testing.T) { |
| 152 | // In PostgreSQL dialect, @@ should still be TokenTypeAtAt |
nothing calls this directly
no test coverage detected