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

Function TestKeywords_CaseSensitivity

pkg/sql/keywords/keywords_test.go:437–459  ·  view source on GitHub ↗

TestKeywords_CaseSensitivity tests case-insensitive keyword matching

(t *testing.T)

Source from the content-addressed store, hash-verified

435
436// TestKeywords_CaseSensitivity tests case-insensitive keyword matching
437func TestKeywords_CaseSensitivity(t *testing.T) {
438 k := New(DialectGeneric, true)
439
440 testCases := []string{
441 "SELECT",
442 "select",
443 "SeLeCt",
444 "sElEcT",
445 }
446
447 for _, word := range testCases {
448 if !k.IsKeyword(word) {
449 t.Errorf("IsKeyword(%q) should be true with case-insensitive matching", word)
450 }
451 if !k.IsReserved(word) {
452 t.Errorf("IsReserved(%q) should be true with case-insensitive matching", word)
453 }
454 tokenType := k.GetTokenType(word)
455 if tokenType != models.TokenTypeSelect {
456 t.Errorf("GetTokenType(%q) = %v, want %v", word, tokenType, models.TokenTypeSelect)
457 }
458 }
459}
460
461// TestKeywords_ReservedForTableAlias tests reserved for table alias functionality
462func TestKeywords_ReservedForTableAlias(t *testing.T) {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected