Skip to content

Commit 09fe7b8

Browse files
committed
test: mark test cases in testsuite locate_project and move on
rust-lang#14091 (comment)
1 parent a1f4d03 commit 09fe7b8

File tree

1 file changed

+14
-34
lines changed

1 file changed

+14
-34
lines changed

tests/testsuite/locate_project.rs

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,38 @@
11
//! Tests for the `cargo locate-project` command.
22
3-
use cargo_test_support::{project, str};
3+
use cargo_test_support::project;
44

55
#[cargo_test]
6+
#[allow(deprecated)]
67
fn simple() {
78
let p = project().build();
89

910
p.cargo("locate-project")
10-
.with_stdout_data(str![[r#"
11-
{"root":"[..]"}
12-
13-
"#]])
11+
.with_json(r#"{"root": "[ROOT]/foo/Cargo.toml"}"#)
1412
.run();
1513
}
1614

1715
#[cargo_test]
16+
#[allow(deprecated)]
1817
fn message_format() {
1918
let p = project().build();
2019

2120
p.cargo("locate-project --message-format plain")
22-
.with_stdout_data(str![[r#"
23-
[ROOT]/foo/Cargo.toml
24-
25-
"#]])
21+
.with_stdout("[ROOT]/foo/Cargo.toml")
2622
.run();
2723

2824
p.cargo("locate-project --message-format json")
29-
.with_stdout_data(str![[r#"
30-
{"root":"[..]"}
31-
32-
"#]])
25+
.with_json(r#"{"root": "[ROOT]/foo/Cargo.toml"}"#)
3326
.run();
3427

3528
p.cargo("locate-project --message-format cryptic")
36-
.with_stderr_data(str![[r#"
37-
[ERROR] invalid message format specifier: `cryptic`
38-
39-
"#]])
29+
.with_stderr("error: invalid message format specifier: `cryptic`")
4030
.with_status(101)
4131
.run();
4232
}
4333

4434
#[cargo_test]
35+
#[allow(deprecated)]
4536
fn workspace() {
4637
let p = project()
4738
.file(
@@ -67,33 +58,22 @@ fn workspace() {
6758
.file("inner/src/lib.rs", "")
6859
.build();
6960

70-
p.cargo("locate-project")
71-
.with_stdout_data(str![[r#"
72-
{"root":"[..]"}
61+
let outer_manifest = r#"{"root": "[ROOT]/foo/Cargo.toml"}"#;
62+
let inner_manifest = r#"{"root": "[ROOT]/foo/inner/Cargo.toml"}"#;
7363

74-
"#]])
75-
.run();
64+
p.cargo("locate-project").with_json(outer_manifest).run();
7665

7766
p.cargo("locate-project")
7867
.cwd("inner")
79-
.with_stdout_data(str![[r#"
80-
{"root":"[..]"}
81-
82-
"#]])
68+
.with_json(inner_manifest)
8369
.run();
8470

8571
p.cargo("locate-project --workspace")
86-
.with_stdout_data(str![[r#"
87-
{"root":"[..]"}
88-
89-
"#]])
72+
.with_json(outer_manifest)
9073
.run();
9174

9275
p.cargo("locate-project --workspace")
9376
.cwd("inner")
94-
.with_stdout_data(str![[r#"
95-
{"root":"[..]"}
96-
97-
"#]])
77+
.with_json(outer_manifest)
9878
.run();
9979
}

0 commit comments

Comments
 (0)