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

Checking for EndOfFile #23

Closed
ythri opened this issue Jul 18, 2024 · 5 comments · Fixed by #24
Closed

Checking for EndOfFile #23

ythri opened this issue Jul 18, 2024 · 5 comments · Fixed by #24
Labels
bug Something isn't working parity Diverging from upstream FileCheck

Comments

@ythri
Copy link

ythri commented Jul 18, 2024

Hey,

I've upgraded from the discontinued mull-project/FileCheck.py 0.0.24 to this one, and now get quite a few errors. One cause is that I use CHECK-EMPTY to test that no more lines occur; e.g. for a file consisting of two lines with content "a" and "b" and a final line break (e.g., a\nb\n), I might have a test with

CHECK: a
CHECK-NEXT: b
CHECK-EMPTY:

to make sure that there is no further line after b (or if there is, it is empty).

This test used to work in mull-project/FileCheck.py, but results in a failed test now, as it now inteprets the last line break not as a new empty line.

So, do you know which behavior is the correct one? Is this a bug in your implementation, or was the discontinued implementation by mull-project non-comforming? Do you have any suggestions on how to change the test to (explicitely) check for EOF?

Thanks for your work!

@AntonLydike
Copy link
Owner

Uh! Thanks for the pointer! I will see how LLVMs FileCheck handles this and let you know!

@AntonLydike AntonLydike added bug Something isn't working parity Diverging from upstream FileCheck labels Jul 18, 2024
@AntonLydike
Copy link
Owner

I can confirm, FileCheck passes this, but we don't:

// RUN: strip-comments.sh %s | filecheck %s
test
// CHECK: test
// CHECK-EMPTY:

Will work on a fix!

@AntonLydike
Copy link
Owner

Allright, I have a fix ready. Although I'm afraid that CHECK-EMPTY can't be used to verify that there is nothing left in the file, as there might be an empty line, and then some more text.

I would suggest you use CHECK-NOT: {{\S+}} instead, which checks that there are no non-space characters left on any line.

@AntonLydike
Copy link
Owner

Thanks for raising this issue! Please let me know if you run into any other problems!

Also, if in case your project is open source, I'm happy to take a quick look and see what else fails. I'm always looking for more data points!

@ythri
Copy link
Author

ythri commented Jul 18, 2024

Wow, thank you so much on the super quick investigation and fix!

Sadly, my code is closed source. But I will try the new version and see if there are still failing tests and give you feedback.

Again, thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parity Diverging from upstream FileCheck
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants