-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Make the 'library' lines in tests use a substitution. #4278
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, some fairly minor comments inline.
@zygoloid - also curious if you think this will be a help with boiler plate by making it (much) more regular?
testing/file_test/file_test_base.cpp
Outdated
static constexpr llvm::StringLiteral TestName = "[[@TEST_NAME]]"; | ||
auto keyword = llvm::StringRef(*content).substr(keyword_pos); | ||
if (keyword.starts_with(TestName)) { | ||
keyword = TestName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious why this is assigned here, it doesn't seem to be used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleaned up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zygoloid - also curious if you think this will be a help with boiler plate by making it (much) more regular?
I think it'll make copy-pasting files within a split-file test easier. I think this would be a win (but a small one).
testing/file_test/file_test_base.cpp
Outdated
// Replaces the content keywords. | ||
// | ||
// TEST_NAME is the only content keyword at present, but we do validate that | ||
// other names |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing end of sentence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has this change been pushed yet? (I don't see the updated file here.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-pushed
Applies #4278 TEST_NAME substitution to tests. Note I've tried to structure commits as: 1. Do all the replacements. 2. autoupdate (nothing else) -- this shows incorrect updates. 3. Fix up manually, including autoupdates to get back to original output.
This opens the door for replacing all
library ...
lines in toolchain test files withlibrary "[[@TEST_NAME]]";
. That's technically more typing in a lot of cases, but OTOH means we can just do some copy-paste boilerplate and stop carefully writing library names.Also cleans up the test setup, because it's getting messy. I'm trying to make it easier to see the divisions of tests and the output associated with them. StringSwitch looked like a way to do this, with a few edits to make it work nicely.