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

Function TestSnowflakeKeywordsBaseOverlap

pkg/sql/keywords/snowflake_test.go:162–193  ·  view source on GitHub ↗

TestSnowflakeKeywordsBaseOverlap verifies that keywords which exist in both the base set and the Snowflake set don't cause issues (the base definition takes precedence since addKeywordsWithCategory skips duplicates).

(t *testing.T)

Source from the content-addressed store, hash-verified

160// the base set and the Snowflake set don't cause issues (the base definition
161// takes precedence since addKeywordsWithCategory skips duplicates).
162func TestSnowflakeKeywordsBaseOverlap(t *testing.T) {
163 k := New(DialectSnowflake, true)
164
165 // These keywords exist in the base set and should retain their base token types
166 baseOverlapKeywords := []struct {
167 word string
168 expectedType models.TokenType
169 }{
170 {"ARRAY", models.TokenTypeArray},
171 {"LATERAL", models.TokenTypeLateral},
172 {"QUALIFY", models.TokenTypeKeyword},
173 {"SAMPLE", models.TokenTypeKeyword},
174 {"CLUSTER", models.TokenTypeKeyword},
175 {"OFFSET", models.TokenTypeOffset},
176 {"SHARE", models.TokenTypeShare},
177 {"LIST", models.TokenTypeKeyword},
178 }
179
180 for _, tt := range baseOverlapKeywords {
181 t.Run(tt.word, func(t *testing.T) {
182 if !k.IsKeyword(tt.word) {
183 t.Errorf("Overlapping keyword %q should exist in Snowflake dialect", tt.word)
184 }
185
186 tokenType := k.GetTokenType(tt.word)
187 if tokenType != tt.expectedType {
188 t.Errorf("GetTokenType(%q) = %v, want %v (base definition should take precedence)",
189 tt.word, tokenType, tt.expectedType)
190 }
191 })
192 }
193}
194
195// TestSnowflakeDialectKeywords verifies DialectKeywords returns the Snowflake keyword list.
196func TestSnowflakeDialectKeywords(t *testing.T) {

Callers

nothing calls this directly

Calls 5

RunMethod · 0.80
GetTokenTypeMethod · 0.80
NewFunction · 0.70
ErrorfMethod · 0.65
IsKeywordMethod · 0.45

Tested by

no test coverage detected