-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test for script as a dependency
Signed-off-by: Rustin170506 <[email protected]>
- Loading branch information
1 parent
9dcdbf1
commit 497943e
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1370,6 +1370,47 @@ registry+https://github.com/rust-lang/crates.io-index#[email protected] | |
.run(); | ||
} | ||
|
||
#[cargo_test(nightly, reason = "edition2024 hasn't hit stable yet")] | ||
fn script_as_dep() { | ||
let p = cargo_test_support::project() | ||
.file("script.rs", ECHO_SCRIPT) | ||
.file("src/lib.rs", "pub fn foo() {}") | ||
.file( | ||
"Cargo.toml", | ||
r#" | ||
[package] | ||
name = "foo" | ||
version = "0.1.0" | ||
[dependencies] | ||
script.path = "script.rs" | ||
"#, | ||
) | ||
.build(); | ||
|
||
p.cargo("build") | ||
.masquerade_as_nightly_cargo(&["script"]) | ||
.with_status(101) | ||
.with_stderr_data(str![[r#" | ||
[WARNING] no edition set: defaulting to the 2015 edition while the latest is 2024 | ||
[ERROR] failed to get `script` as a dependency of package `foo v0.1.0 ([ROOT]/foo)` | ||
Caused by: | ||
failed to load source for dependency `script` | ||
Caused by: | ||
Unable to update [ROOT]/foo/script.rs | ||
Caused by: | ||
failed to read `[ROOT]/foo/script.rs/Cargo.toml` | ||
Caused by: | ||
Not a directory (os error 20) | ||
"#]]) | ||
.run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn cmd_package_with_embedded() { | ||
let p = cargo_test_support::project() | ||
|