Skip to content

Commit 16e8913

Browse files
committed
Add tests
1 parent d9f8591 commit 16e8913

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

src/lib.rs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,50 @@ mod tests {
734734
assert_eq!(format(input, &QueryParams::None, &options), input);
735735
}
736736

737+
#[test]
738+
fn it_does_not_indent_next_statement_when_max_inline_arguments_is_some_nat() {
739+
let args = [None, Some(0), Some(999)];
740+
741+
for arg in args {
742+
let input = indoc!(
743+
"
744+
DROP INDEX IF EXISTS idx_a;
745+
746+
DROP INDEX IF EXISTS idx_b;
747+
"
748+
);
749+
let options = FormatOptions {
750+
max_inline_arguments: arg,
751+
..Default::default()
752+
};
753+
let expected = indoc!(
754+
"
755+
DROP INDEX IF EXISTS idx_a;
756+
757+
DROP INDEX IF EXISTS idx_b;
758+
"
759+
);
760+
761+
assert_eq!(format(input, &QueryParams::None, &options), expected);
762+
763+
let input = indoc!(
764+
r#"
765+
-- comment
766+
DROP TABLE IF EXISTS "public"."table_name";
767+
"#
768+
);
769+
770+
let expected = indoc!(
771+
r#"
772+
-- comment
773+
DROP TABLE IF EXISTS "public"."table_name";
774+
"#
775+
);
776+
777+
assert_eq!(format(input, &QueryParams::None, &options), expected);
778+
}
779+
}
780+
737781
#[test]
738782
fn it_formats_incomplete_query() {
739783
let input = "SELECT count(";

0 commit comments

Comments
 (0)