Skip to content

Commit 2a4dc4d

Browse files
committed
made the tests pass by showing the current behaviour
1 parent 726f246 commit 2a4dc4d

File tree

1 file changed

+55
-47
lines changed

1 file changed

+55
-47
lines changed

tests/testsuite/path.rs

Lines changed: 55 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,41 +1071,42 @@ Caused by:
10711071
.run();
10721072
}
10731073

1074-
// #[cargo_test]
1075-
// fn invalid_base() {
1076-
// let p = project()
1077-
// .file(
1078-
// "Cargo.toml",
1079-
// r#"
1080-
// cargo-features = ["path-bases"]
1081-
1082-
// [package]
1083-
// name = "foo"
1084-
// version = "0.5.0"
1085-
// authors = ["wycats@example.com"]
1086-
1087-
// [dependencies]
1088-
// bar = { base = '^^not-valid^^', path = 'bar' }
1089-
// "#,
1090-
// )
1091-
// .file("src/lib.rs", "")
1092-
// .build();
1093-
1094-
// p.cargo("build")
1095-
// .masquerade_as_nightly_cargo(&["path-bases"])
1096-
// .with_status(101)
1097-
// .with_stderr_data(
1098-
// "\
1099-
// [ERROR] invalid character `^` in path base name: `^^not-valid^^`, the first character must be a Unicode XID start character (most letters or `_`)
1100-
1101-
// --> Cargo.toml:10:23
1102-
// |
1103-
// 10 | bar = { base = '^^not-valid^^', path = 'bar' }
1104-
// | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1105-
// ",
1106-
// )
1107-
// .run();
1108-
// }
1074+
#[cargo_test]
1075+
fn invalid_base() {
1076+
let p = project()
1077+
.file(
1078+
"Cargo.toml",
1079+
r#"
1080+
cargo-features = ["path-bases"]
1081+
1082+
[package]
1083+
name = "foo"
1084+
version = "0.5.0"
1085+
authors = ["wycats@example.com"]
1086+
1087+
[dependencies]
1088+
bar = { base = '^^not-valid^^', path = 'bar' }
1089+
"#,
1090+
)
1091+
.file("src/lib.rs", "")
1092+
.build();
1093+
1094+
p.cargo("build")
1095+
.masquerade_as_nightly_cargo(&["path-bases"])
1096+
.with_status(101)
1097+
.with_stderr_data(
1098+
"\
1099+
[ERROR] invalid character `^` in path base name: `^^not-valid^^`, the first character must be a Unicode XID start character (most letters or `_`)
1100+
1101+
1102+
--> Cargo.toml:10:23
1103+
|
1104+
10 | bar = { base = '^^not-valid^^', path = 'bar' }
1105+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1106+
",
1107+
)
1108+
.run();
1109+
}
11091110

11101111
#[cargo_test]
11111112
fn invalid_path_with_base() {
@@ -1951,13 +1952,13 @@ fn invalid_package_name_in_path() {
19511952
.file("crates/bar/src/lib.rs", "")
19521953
.build();
19531954

1954-
p.cargo("check")
1955+
p.cargo("generate-lockfile")
19551956
.with_status(101)
19561957
.with_stderr_data(str![[r#"
1957-
error: no matching package named `definitely_not_bar` found at `bar/`
1958-
note: required by package `foo v0.1.0 (/Users/eric/Temp/foo)`
1958+
[ERROR] no matching package named `definitely_not_bar` found
1959+
location searched: [ROOT]/foo/crates/bar
1960+
required by package `foo v0.5.0 ([ROOT]/foo)`
19591961
1960-
help: package `bar` exists at `bar/`
19611962
"#]])
19621963
.run();
19631964
}
@@ -1997,10 +1998,14 @@ fn invalid_package_in_subdirectory() {
19971998
p.cargo("check")
19981999
.with_status(101)
19992000
.with_stderr_data(str![[r#"
2000-
error: no matching package named `definitely_not_bar` found at `bar/`
2001-
note: required by package `foo v0.1.0 (/Users/eric/Temp/foo)`
2001+
[ERROR] failed to load manifest for dependency `definitely_not_bar`
2002+
2003+
Caused by:
2004+
failed to read `[ROOT]/foo/crates/bar/Cargo.toml`
2005+
2006+
Caused by:
2007+
[NOT_FOUND]
20022008
2003-
help: package `definitely_not_bar` exists at `bar/definitely_not_bar/`
20042009
"#]])
20052010
.run();
20062011
}
@@ -2051,11 +2056,14 @@ fn invalid_manifest_in_path() {
20512056
p.cargo("check")
20522057
.with_status(101)
20532058
.with_stderr_data(str![[r#"
2054-
error: no matching package named `definitely_not_bar` found at `bar/`
2055-
note: required by package `foo v0.1.0 (/Users/eric/Temp/foo)`
2059+
[ERROR] failed to load manifest for dependency `definitely_not_bar`
2060+
2061+
Caused by:
2062+
failed to read `[ROOT]/foo/crates/bar/Cargo.toml`
20562063
2057-
help: package `alice` exists at `bar/alice/`
2058-
help: package `bob` exists at `bar/bob/`
2059-
"#]])
2064+
Caused by:
2065+
[NOT_FOUND]
2066+
2067+
"#]])
20602068
.run();
20612069
}

0 commit comments

Comments
 (0)