-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
test: migrate testsuites to snapbox #14091
Conversation
r? @weihanglo |
ef8e59e
to
20768f7
Compare
tests/testsuite/message_format.rs
Outdated
@@ -108,7 +113,13 @@ fn cargo_renders_ansi() { | |||
|
|||
p.cargo("check --message-format json-diagnostic-rendered-ansi") | |||
.with_status(101) | |||
.with_stdout_contains("[..]\\u001b[38;5;9merror[..]") | |||
.with_stdout_data(str![[r#" | |||
{"reason":"compiler-message","package_id":"path+[ROOTURL]/foo#0.1.0","manifest_path":"[..]","target":{"kind":["bin"],"crate_types":["bin"],"name":"foo","src_path":"[..]","edition":"2015","doc":true,"doctest":false,"test":true},"message":{"$message_type":"diagnostic","message":"`main` function not found in crate `foo`","code":{"code":"E0601","explanation":"No `main` function was found in a binary crate./n/nTo fix this error, add a `main` function:/n/n```/nfn main() {/n // Your program will start here./n println!(/"Hello world!/");/n}/n```/n/nIf you don't know the basics of Rust, you can look at the/n[Rust Book][rust-book] to get started./n/n[rust-book]: https://doc.rust-lang.org/book//n"},"level":"error","spans":[{"file_name":"src/main.rs","byte_start":0,"byte_end":0,"line_start":0,"line_end":0,"column_start":1,"column_end":1,"is_primary":true,"text":[],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"consider adding a `main` function to `src/main.rs`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"/u001b[0m/u001b[1m/u001b[38;5;9merror[E0601]/u001b[0m/u001b[0m/u001b[1m: `main` function not found in crate `foo`/u001b[0m/n/u001b[0m /u001b[0m/u001b[0m/u001b[1m/u001b[38;5;12m|/u001b[0m/n/u001b[0m /u001b[0m/u001b[0m/u001b[1m/u001b[38;5;12m= /u001b[0m/u001b[0m/u001b[1mnote/u001b[0m/u001b[0m: consider adding a `main` function to `src/main.rs`/u001b[0m/n/n"}} |
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.
I guess we only need to check \\u001b[38;5;9merror
here?
ac227e0
to
ba19274
Compare
tests/testsuite/locate_project.rs
Outdated
let outer_manifest = r#"{"root": "[ROOT]/foo/Cargo.toml"}"#; | ||
let inner_manifest = r#"{"root": "[ROOT]/foo/inner/Cargo.toml"}"#; |
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.
Guess it's also possible to do something alike? By extracting them as variables, we can make sure invocations that are ought to be the same still get the same JSON.
let outer_manifest = r#"{"root": "[ROOT]/foo/Cargo.toml"}"#; | |
let inner_manifest = r#"{"root": "[ROOT]/foo/inner/Cargo.toml"}"#; | |
let outer_manifest = str![[r#"{"root": "[ROOT]/foo/Cargo.toml"}"#]]; | |
let inner_manifest = str![[r#"{"root": "[ROOT]/foo/inner/Cargo.toml"}"#]]; |
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 appears the suggested change might have a typo
let inner_manifest = str![[r#"{"root": "[ROOT]/foo/inner/Cargo.toml"}"#]];
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. Just one thing left and we're ready to go.
I'll tidy up commits after CI passes. |
This reverts commit 2fbba53.
@weihanglo I've finished arranging the commits. |
Thanks! @bors r+ |
☀️ Test successful - checks-actions |
Update cargo 17 commits in 3ed207e416fb2f678a40cc79c02dcf4f936a21ce..bc89bffa5987d4af8f71011c7557119b39e44a65 2024-06-18 19:18:22 +0000 to 2024-06-22 00:36:36 +0000 - test: migrate weak_dep_features, workspaces and yank to snapbox (rust-lang/cargo#14111) - test: migrate features and features(2|_namespaced) to snapbox (rust-lang/cargo#14100) - test: Add auto-redaction for not found error (rust-lang/cargo#14124) - test: migrate build to snapbox (rust-lang/cargo#14068) - test: migrate unit_graph, update and vendor to snapbox (rust-lang/cargo#14119) - fix(test): Un-redact Packaged files (rust-lang/cargo#14123) - test: Auto-redact file number (rust-lang/cargo#14121) - test: migrate lints_table and lints/(mod|unknown_lints) to snapbox (rust-lang/cargo#14104) - Simplify checking feature syntax (rust-lang/cargo#14106) - test: migrate testsuites to snapbox (rust-lang/cargo#14091) - Make `-Cmetadata` consistent across platforms (rust-lang/cargo#14107) - fix(toml): Warn when edition is unuset, even when MSRV is unset (rust-lang/cargo#14110) - Add `CodeFix::apply_solution` and impl `Clone` (rust-lang/cargo#14092) - test: migrate `cargo_alias_config&cargo_config/mod` to snapbox (rust-lang/cargo#14093) - Simplify checking for dependency cycles (rust-lang/cargo#14089) - test: Migrate `pub_priv.rs` to snapshot (rust-lang/cargo#14103) - test: migrate rustdoc and rustdocflags to snapbox (rust-lang/cargo#14098) <!-- r? ghost -->
Update cargo 17 commits in 3ed207e416fb2f678a40cc79c02dcf4f936a21ce..bc89bffa5987d4af8f71011c7557119b39e44a65 2024-06-18 19:18:22 +0000 to 2024-06-22 00:36:36 +0000 - test: migrate weak_dep_features, workspaces and yank to snapbox (rust-lang/cargo#14111) - test: migrate features and features(2|_namespaced) to snapbox (rust-lang/cargo#14100) - test: Add auto-redaction for not found error (rust-lang/cargo#14124) - test: migrate build to snapbox (rust-lang/cargo#14068) - test: migrate unit_graph, update and vendor to snapbox (rust-lang/cargo#14119) - fix(test): Un-redact Packaged files (rust-lang/cargo#14123) - test: Auto-redact file number (rust-lang/cargo#14121) - test: migrate lints_table and lints/(mod|unknown_lints) to snapbox (rust-lang/cargo#14104) - Simplify checking feature syntax (rust-lang/cargo#14106) - test: migrate testsuites to snapbox (rust-lang/cargo#14091) - Make `-Cmetadata` consistent across platforms (rust-lang/cargo#14107) - fix(toml): Warn when edition is unuset, even when MSRV is unset (rust-lang/cargo#14110) - Add `CodeFix::apply_solution` and impl `Clone` (rust-lang/cargo#14092) - test: migrate `cargo_alias_config&cargo_config/mod` to snapbox (rust-lang/cargo#14093) - Simplify checking for dependency cycles (rust-lang/cargo#14089) - test: Migrate `pub_priv.rs` to snapshot (rust-lang/cargo#14103) - test: migrate rustdoc and rustdocflags to snapbox (rust-lang/cargo#14098) <!-- r? ghost -->
What does this PR try to resolve?
Part of #14039.
Migrate the following testsuites to snapbox:
tests/testsuite/locate_project.rssee test: migrate testsuites to snapbox #14091 (comment)How should we test and review this PR?
N/A
Additional information
N/A