Skip to content

Commit

Permalink
Auto merge of rust-lang#13864 - justahero:fix/cargo-contributor-ui-te…
Browse files Browse the repository at this point in the history
…st-code, r=weihanglo

Update UI example code in contributor guide

This updates the UI example case code in paragraph ["Writing Tests"](https://doc.crates.io/contrib/tests/writing.html#ui-tests) of the Cargo Contributor Guide. The previous code snippet did not compile successfully anymore.
  • Loading branch information
bors committed May 6, 2024
2 parents f489938 + c71f042 commit 85a4d70
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/doc/contrib/src/tests/writing.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,15 @@ mod <case>;

`tests/testsuite/<command>/<case>/mod.rs`:
```rust,ignore
use cargo_test_support::prelude::*;
use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::Project;
use cargo_test_support::curr_dir;
#[cargo_test]
fn case() {
let project = Project::from_template(curr_dir!().join("in"));
let project = Project::from_template(current_dir!().join("in"));
let project_root = project.root();
let cwd = &project_root;
Expand All @@ -224,10 +225,10 @@ fn case() {
.current_dir(cwd)
.assert()
.success()
.stdout_matches_path(curr_dir!().join("stdout.log"))
.stderr_matches_path(curr_dir!().join("stderr.log"));
.stdout_matches(file!("stdout.log"))
.stderr_matches(file!("stderr.log"));
assert_ui().subset_matches(curr_dir!().join("out"), &project_root);
assert_ui().subset_matches(current_dir!().join("out"), &project_root);
}
```

Expand Down

0 comments on commit 85a4d70

Please sign in to comment.