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

Function TestKeywords_WindowFunctionKeywords

pkg/sql/keywords/keywords_test.go:500–533  ·  view source on GitHub ↗

TestKeywords_WindowFunctionKeywords tests Phase 2.5 window function keywords

(t *testing.T)

Source from the content-addressed store, hash-verified

498
499// TestKeywords_WindowFunctionKeywords tests Phase 2.5 window function keywords
500func TestKeywords_WindowFunctionKeywords(t *testing.T) {
501 k := New(DialectGeneric, true)
502
503 // Window function keywords
504 windowKeywords := []string{
505 "OVER", "ROWS", "RANGE", "CURRENT", "ROW", "UNBOUNDED",
506 "PRECEDING", "FOLLOWING",
507 }
508
509 for _, word := range windowKeywords {
510 if !k.IsKeyword(word) {
511 t.Errorf("Window keyword %q should exist", word)
512 }
513 if !k.IsReserved(word) {
514 t.Errorf("Window keyword %q should be reserved", word)
515 }
516 }
517
518 // Window function names (non-reserved)
519 windowFunctions := []string{
520 "ROW_NUMBER", "RANK", "DENSE_RANK", "NTILE",
521 "LAG", "LEAD", "FIRST_VALUE", "LAST_VALUE",
522 }
523
524 for _, word := range windowFunctions {
525 if !k.IsKeyword(word) {
526 t.Errorf("Window function %q should exist", word)
527 }
528 // These should NOT be reserved (they're function names)
529 if k.IsReserved(word) {
530 t.Errorf("Window function %q should NOT be reserved", word)
531 }
532 }
533}
534
535// TestKeywords_CompoundKeywordVariations tests various compound keyword formats
536func TestKeywords_CompoundKeywordVariations(t *testing.T) {

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected