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

Function TestWindowFrameSQL

pkg/sql/ast/sql_coverage_test.go:381–403  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

379}
380
381func TestWindowFrameSQL(t *testing.T) {
382 // Test through SelectStatement with window spec that has frame
383 stmt := &SelectStatement{
384 Columns: []Expression{&Identifier{Name: "x"}},
385 From: []TableReference{{Name: "t"}},
386 Windows: []WindowSpec{
387 {
388 Name: "w1",
389 PartitionBy: []Expression{&Identifier{Name: "a"}},
390 OrderBy: []OrderByExpression{{Expression: &Identifier{Name: "b"}, Ascending: true}},
391 FrameClause: &WindowFrame{
392 Type: "ROWS",
393 Start: WindowFrameBound{Type: "UNBOUNDED PRECEDING"},
394 End: &WindowFrameBound{Type: "CURRENT ROW"},
395 },
396 },
397 },
398 }
399 sql := stmt.SQL()
400 if !strings.Contains(sql, "ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW") {
401 t.Errorf("got: %s", sql)
402 }
403}
404
405func TestFetchSQL(t *testing.T) {
406 fv := int64(10)

Callers

nothing calls this directly

Calls 2

SQLMethod · 0.95
ErrorfMethod · 0.65

Tested by

no test coverage detected