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

test: migrate testsuites to snapbox #14091

Merged
merged 5 commits into from
Jun 20, 2024
Merged

Conversation

henry40408
Copy link
Contributor

@henry40408 henry40408 commented Jun 17, 2024

What does this PR try to resolve?

Part of #14039.

Migrate the following testsuites to snapbox:

How should we test and review this PR?

N/A

Additional information

N/A

@rustbot
Copy link
Collaborator

rustbot commented Jun 17, 2024

r? @epage

rustbot has assigned @epage.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 17, 2024
@henry40408
Copy link
Contributor Author

r? @weihanglo

@rustbot rustbot assigned weihanglo and unassigned epage Jun 17, 2024
@henry40408 henry40408 force-pushed the issue-14039 branch 6 times, most recently from ef8e59e to 20768f7 Compare June 18, 2024 12:33
tests/testsuite/locate_project.rs Outdated Show resolved Hide resolved
@@ -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"}}
Copy link
Member

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?

tests/testsuite/locate_project.rs Outdated Show resolved Hide resolved
tests/testsuite/locate_project.rs Outdated Show resolved Hide resolved
Comment on lines 60 to 61
let outer_manifest = r#"{"root": "[ROOT]/foo/Cargo.toml"}"#;
let inner_manifest = r#"{"root": "[ROOT]/foo/inner/Cargo.toml"}"#;
Copy link
Member

@weihanglo weihanglo Jun 18, 2024

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.

Suggested change
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"}"#]];

Copy link
Contributor

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"}"#]];

tests/testsuite/message_format.rs Outdated Show resolved Hide resolved
tests/testsuite/message_format.rs Outdated Show resolved Hide resolved
tests/testsuite/version.rs Outdated Show resolved Hide resolved
tests/testsuite/version.rs Show resolved Hide resolved
Copy link
Member

@weihanglo weihanglo left a 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.

tests/testsuite/version.rs Outdated Show resolved Hide resolved
@henry40408
Copy link
Contributor Author

I'll tidy up commits after CI passes.

@henry40408
Copy link
Contributor Author

@weihanglo I've finished arranging the commits.

@weihanglo
Copy link
Member

Thanks!

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 20, 2024

📌 Commit 2c517d9 has been approved by weihanglo

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 20, 2024
@bors
Copy link
Collaborator

bors commented Jun 20, 2024

⌛ Testing commit 2c517d9 with merge 96fc12c...

@bors
Copy link
Collaborator

bors commented Jun 20, 2024

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing 96fc12c to master...

@bors bors merged commit 96fc12c into rust-lang:master Jun 20, 2024
22 checks passed
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 22, 2024
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
-->
@rustbot rustbot added this to the 1.81.0 milestone Jun 22, 2024
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jun 23, 2024
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
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants