| 1 | package sqlparser |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | ) |
| 6 | |
| 7 | func TestRedactSQLStatements(t *testing.T) { |
| 8 | sql := "select a,b,c from t where x = 1234 and y = 1234 and z = 'apple'" |
| 9 | redactedSQL, err := RedactSQLQuery(sql) |
| 10 | if err != nil { |
| 11 | t.Fatalf("redacting sql failed: %v", err) |
| 12 | } |
| 13 | |
| 14 | if redactedSQL != "select a, b, c from t where x = :redacted1 and y = :redacted1 and z = :redacted2" { |
| 15 | t.Fatalf("Unknown sql redaction: %v", redactedSQL) |
| 16 | } |
| 17 | } |