From eb6cab491961bd15311eefacfa4760741b4bff8f Mon Sep 17 00:00:00 2001 From: Emilien Bauer Date: Mon, 4 Nov 2024 14:36:45 +0000 Subject: [PATCH 1/2] Add spacing between streaks of CHECK-NEXT by default, and --compact-output for compatibility. --- filecheckize/main.py | 8 +++++++ tests/filecheck/empty-lines.mlir | 38 ++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/filecheck/empty-lines.mlir diff --git a/filecheckize/main.py b/filecheckize/main.py index 6c5714e..c325202 100644 --- a/filecheckize/main.py +++ b/filecheckize/main.py @@ -19,6 +19,11 @@ def main(): help="Input file to read. Defaults to standard input.", ) group = parser.add_mutually_exclusive_group() + group.add_argument( + "--compact-output", + action="store_true", + help="Do not print empty lines between streaks of CHECK-NEXT.", + ) group.add_argument( "--mlir-anonymize", action="store_true", @@ -72,6 +77,9 @@ def main(): print(f"// {prefix}-EMPTY:") next = True else: + # Print empty lines between streaks of CHECK-NEXT + if next and not args.compact_output: + print("") next = False continue diff --git a/tests/filecheck/empty-lines.mlir b/tests/filecheck/empty-lines.mlir new file mode 100644 index 0000000..6be0804 --- /dev/null +++ b/tests/filecheck/empty-lines.mlir @@ -0,0 +1,38 @@ +// RUN: filecheckize %s | filecheck %s +// RUN: filecheckize --compact-output %s | filecheck %s --check-prefix COMPACT + +someline +someotherline + +someafterskipline +someotherafterskipline + + +someafter2lines +someotherafter2lines + + + +someafter3lines +someotherafter3lines + +// CHECK: // CHECK: someline +// CHECK-NEXT: // CHECK-NEXT: someotherline +// CHECK-EMPTY: +// CHECK-NEXT: // CHECK: someafterskipline +// CHECK-NEXT: // CHECK-NEXT: someotherafterskipline +// CHECK-EMPTY: +// CHECK-NEXT: // CHECK: someafter2lines +// CHECK-NEXT: // CHECK-NEXT: someotherafter2lines +// CHECK-EMPTY: +// CHECK-NEXT: // CHECK: someafter3lines +// CHECK-NEXT: // CHECK-NEXT: someotherafter3lines + +// COMPACT: // CHECK: someline +// COMPACT-NEXT: // CHECK-NEXT: someotherline +// COMPACT-NEXT: // CHECK: someafterskipline +// COMPACT-NEXT: // CHECK-NEXT: someotherafterskipline +// COMPACT-NEXT: // CHECK: someafter2lines +// COMPACT-NEXT: // CHECK-NEXT: someotherafter2lines +// COMPACT-NEXT: // CHECK: someafter3lines +// COMPACT-NEXT: // CHECK-NEXT: someotherafter3lines \ No newline at end of file From 04506a3ccfa0ec83e2ff856b2154223d21eef1ed Mon Sep 17 00:00:00 2001 From: Emilien Bauer Date: Mon, 4 Nov 2024 14:37:54 +0000 Subject: [PATCH 2/2] EOL --- tests/filecheck/empty-lines.mlir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/filecheck/empty-lines.mlir b/tests/filecheck/empty-lines.mlir index 6be0804..b410448 100644 --- a/tests/filecheck/empty-lines.mlir +++ b/tests/filecheck/empty-lines.mlir @@ -35,4 +35,4 @@ someotherafter3lines // COMPACT-NEXT: // CHECK: someafter2lines // COMPACT-NEXT: // CHECK-NEXT: someotherafter2lines // COMPACT-NEXT: // CHECK: someafter3lines -// COMPACT-NEXT: // CHECK-NEXT: someotherafter3lines \ No newline at end of file +// COMPACT-NEXT: // CHECK-NEXT: someotherafter3lines