-
Notifications
You must be signed in to change notification settings - Fork 2.6k
test: Migrate some files to snapbox #14069
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s | ||
[DOCTEST] foo | ||
[RUNNING] `rustdoc [..]--crate-name foo [..]-C link-arg=--this-is-a-bogus-flag[..] | ||
[ERROR] doctest failed, to rerun pass `--doc` |
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.
CI failed, but my local was a success.
tests/testsuite/cache_messages.rs
Outdated
", | ||
expected | ||
)) | ||
.run(); | ||
} | ||
|
||
#[allow(deprecated)] |
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.
On account ofwith_stderr_does_not_contain()
,added #[allow(deprecated)]
.
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.
It seems like we can just assert stdout with str![]
to replace with_stderr_does_not_contain
here. They should be all empty except the very first invocation.
And we can add str!
for each with_stderr_data
.
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.
You're right. The first one looks empty too.
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.
Sorry. FOund that I was wrong 🤦🏾♂️. WRAPPER CALLED:
might be matched by ...
wild card. We should keep with_stderr_does_not_contain
. Maybe make the literal shorter so it won't accidentally mismatch in the future? Like with_stderr_does_not_contain("WRAPPER CALLED: [..])
?
.with_stdout_does_not_contain( | ||
"WRAPPER CALLED: rustc --crate-name foo --edition=2015 src/lib.rs [..]", | ||
) | ||
.run(); | ||
} | ||
|
||
#[allow(deprecated)] |
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.
On account ofwith_stderr_does_not_contain()
,added #[allow(deprecated)]
.
0d255dd
to
0f4f256
Compare
tests/testsuite/cache_messages.rs
Outdated
@@ -160,7 +159,17 @@ fn clears_cache_after_fix() { | |||
// Make sure the cache is invalidated when there is no output. | |||
let p = project().file("src/lib.rs", "fn asdf() {}").build(); | |||
// Fill the cache. | |||
p.cargo("check").with_stderr_contains("[..]asdf[..]").run(); | |||
p.cargo("check") | |||
.with_stderr_data( |
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.
While rustc invocation is omitted, I believe we can still wrap it with str![]
.
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.
Thanks, it has been modified.
BTW: Sorry, I'm a bit confused now, what are the criteria for using or not using str![]
?
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.
See #14039 "4. Resolve non-literal deprecations".
To me, I try porting all of the with str![]
unless it is too specific, fragile, or hard to model with str![]
.
05cfed0
to
b0f4c94
Compare
"\ | ||
[FRESH] foo v0.0.1 ([ROOT]/foo) | ||
WRAPPER CALLED: rustc [..] | ||
... |
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.
This is not necessary and can be wrapped with str![]
... |
tests/testsuite/cache_messages.rs
Outdated
", | ||
expected | ||
)) | ||
.run(); | ||
} | ||
|
||
#[allow(deprecated)] |
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.
It seems like we can just assert stdout with str![]
to replace with_stderr_does_not_contain
here. They should be all empty except the very first invocation.
And we can add str!
for each with_stderr_data
.
b0f4c94
to
ebb795c
Compare
ebb795c
to
2e1f7b4
Compare
Thanks. Looks good. @bors r+ |
☀️ Test successful - checks-actions |
Update cargo 13 commits in a1f47ec3f7cd076986f1bfcd7061f2e8cb1a726e..3ed207e416fb2f678a40cc79c02dcf4f936a21ce 2024-06-15 01:10:07 +0000 to 2024-06-18 19:18:22 +0000 - test: prefer raw string for regex reduction (rust-lang/cargo#14099) - test: migrate tree and tree_graph_features to snapbox (rust-lang/cargo#14094) - test: Migrate some files to snapbox (rust-lang/cargo#14069) - remove some legacy public dependency code from the resolver (rust-lang/cargo#14090) - fix(fix): Address problems with implicit -> explicit feature migration (rust-lang/cargo#14018) - refactor: 1.79 cleanup (rust-lang/cargo#14088) - test: migrate `git_(gc|shallow)` to snapbox (rust-lang/cargo#14087) - test: migrate timings_works to snapbox (rust-lang/cargo#14082) - test: migrate minimal_versions to snapbox (rust-lang/cargo#14080) - Remove `run_expect_error` to avoid tests incorrectly passing (rust-lang/cargo#14078) - test: migrate help to snapbox (rust-lang/cargo#14060) - test: Migrate tests/testsuite/co*.rs to snapbox (rust-lang/cargo#14079) - Use `std::fs::absolute` instead of reimplementing it (rust-lang/cargo#14075) <!-- r? ghost -->
What does this PR try to resolve?
This PR addresses the migration of the following files:
tests/testsuite/build_script_extra_link_arg.rs
tests/testsuite/cache_lock.rs
tests/testsuite/cache_messages.rs
part of #14039