Skip to content

Commit

Permalink
fix: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
psteinroe committed Aug 10, 2024
1 parent 866ee74 commit b762b8f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions crates/pg_statement_splitter/src/statement_splitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,19 @@ DROP ROLE IF EXISTS regress_alter_generic_user1;";
assert_eq!(SyntaxKind::Any, result[1].kind);
}

#[test]
fn test_only_incomplete_statement_semicolon() {
let input = "create;\nselect 1;";

let result = StatementSplitter::new(input).run();

assert_eq!(result.len(), 2);
assert_eq!("create", input[result[0].range].to_string());
assert_eq!(SyntaxKind::Any, result[0].kind);
assert_eq!("select 1;", input[result[1].range].to_string());
assert_eq!(SyntaxKind::SelectStmt, result[1].kind);
}

#[test]
fn test_only_incomplete_statement() {
let input = " create ";
Expand Down

0 comments on commit b762b8f

Please sign in to comment.