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

Function TestScan_HavingClause

pkg/sql/security/scanner_test.go:454–473  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

452}
453
454func TestScan_HavingClause(t *testing.T) {
455 scanner := NewScanner()
456
457 // SELECT ... HAVING 1=1
458 selectStmt := &ast.SelectStatement{
459 Columns: []ast.Expression{&ast.Identifier{Name: "COUNT(*)"}},
460 Having: &ast.BinaryExpression{
461 Left: &ast.LiteralValue{Value: "1", Type: "INTEGER"},
462 Operator: "=",
463 Right: &ast.LiteralValue{Value: "1", Type: "INTEGER"},
464 },
465 }
466
467 tree := &ast.AST{Statements: []ast.Statement{selectStmt}}
468 result := scanner.Scan(tree)
469
470 if result.CriticalCount == 0 {
471 t.Error("expected critical finding for HAVING 1=1 tautology")
472 }
473}
474
475func TestScan_NestedExpressions(t *testing.T) {
476 scanner := NewScanner()

Callers

nothing calls this directly

Calls 3

ScanMethod · 0.95
NewScannerFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected