Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spacing by default and --compact-output for compatibility. #7

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions filecheckize/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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

Expand Down
38 changes: 38 additions & 0 deletions tests/filecheck/empty-lines.mlir
Original file line number Diff line number Diff line change
@@ -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
Loading