TestKeywords_AggregateFunctions tests aggregate function keywords
(t *testing.T)
| 632 | |
| 633 | // TestKeywords_AggregateFunctions tests aggregate function keywords |
| 634 | func TestKeywords_AggregateFunctions(t *testing.T) { |
| 635 | k := New(DialectGeneric, true) |
| 636 | |
| 637 | aggregateFunctions := []struct { |
| 638 | word string |
| 639 | expectedType models.TokenType |
| 640 | }{ |
| 641 | {"COUNT", models.TokenTypeCount}, |
| 642 | {"SUM", models.TokenTypeSum}, |
| 643 | {"AVG", models.TokenTypeAvg}, |
| 644 | {"MIN", models.TokenTypeMin}, |
| 645 | {"MAX", models.TokenTypeMax}, |
| 646 | } |
| 647 | |
| 648 | for _, af := range aggregateFunctions { |
| 649 | // Test case variations |
| 650 | testVariations := []string{af.word, strings.ToLower(af.word)} |
| 651 | for _, word := range testVariations { |
| 652 | if !k.IsKeyword(word) { |
| 653 | t.Errorf("Aggregate function %q should be a keyword", word) |
| 654 | } |
| 655 | if !k.IsReserved(word) { |
| 656 | t.Errorf("Aggregate function %q should be reserved", word) |
| 657 | } |
| 658 | |
| 659 | tokenType := k.GetTokenType(word) |
| 660 | if tokenType != af.expectedType { |
| 661 | t.Errorf("GetTokenType(%q) = %v, want %v", word, tokenType, af.expectedType) |
| 662 | } |
| 663 | } |
| 664 | } |
| 665 | } |
| 666 | |
| 667 | // TestKeywords_CaseSensitiveMode tests case-sensitive keyword matching |
| 668 | func TestKeywords_CaseSensitiveMode(t *testing.T) { |
nothing calls this directly
no test coverage detected