Skip to content

Commit

Permalink
tests: move test to proper lint (#408)
Browse files Browse the repository at this point in the history
was put in the wrong file in c3979a9
  • Loading branch information
sbdchd authored Jan 26, 2025
1 parent 2b69ef5 commit 08dc70e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
1 change: 0 additions & 1 deletion linter/src/rules/adding_field_with_default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ pub fn adding_field_with_default(
.filter(|x| !x.is_empty())
.collect();

// println!("{:#?}", non_volatile_funcs);
for raw_stmt in tree {
match &raw_stmt.stmt {
Stmt::AlterTableStmt(stmt) => {
Expand Down
13 changes: 0 additions & 13 deletions linter/src/rules/ban_char_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,4 @@ COMMIT;
"#;
assert_debug_snapshot!(lint_sql(sql));
}
#[test]
fn regression_with_indexing_2() {
let sql = r#"
BEGIN;
ALTER TABLE "core_recipe" ADD COLUMN "foo" integer DEFAULT 10;
ALTER TABLE "core_recipe" ADD CONSTRAINT foo_not_null
CHECK ("foo" IS NOT NULL) NOT VALID;
COMMIT;
BEGIN;
"#;
assert_debug_snapshot!(lint_sql(sql));
}
}
14 changes: 14 additions & 0 deletions linter/src/rules/constraint_missing_not_valid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,18 @@ ALTER TABLE accounts VALIDATE CONSTRAINT positive_balance;

assert_debug_snapshot!(lint_sql(ok_sql));
}

#[test]
fn regression_with_indexing_2() {
let sql = r#"
BEGIN;
ALTER TABLE "core_recipe" ADD COLUMN "foo" integer DEFAULT 10;
ALTER TABLE "core_recipe" ADD CONSTRAINT foo_not_null
CHECK ("foo" IS NOT NULL) NOT VALID;
COMMIT;
BEGIN;
"#;
assert_debug_snapshot!(lint_sql(sql));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: linter/src/rules/constraint_missing_not_valid.rs
expression: lint_sql(sql)
---
[]

0 comments on commit 08dc70e

Please sign in to comment.