Skip to content

Commit 589d099

Browse files
committed
test(script): Verify manifest modification commands
1 parent e0477a3 commit 589d099

22 files changed

+521
-0
lines changed

tests/testsuite/cargo_add/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ mod rustc_ignore;
138138
mod rustc_incompatible;
139139
mod rustc_latest;
140140
mod rustc_older;
141+
mod script_bare;
142+
mod script_frontmatter;
143+
mod script_shebang;
141144
mod sorted_table_with_dotted_item;
142145
mod target;
143146
mod target_cfg;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn main() {}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
use cargo_test_support::compare::assert_ui;
2+
use cargo_test_support::current_dir;
3+
use cargo_test_support::file;
4+
use cargo_test_support::prelude::*;
5+
use cargo_test_support::str;
6+
use cargo_test_support::Project;
7+
8+
#[cargo_test]
9+
fn case() {
10+
cargo_test_support::registry::init();
11+
for ver in [
12+
"0.1.1+my-package",
13+
"0.2.0+my-package",
14+
"0.2.3+my-package",
15+
"0.4.1+my-package",
16+
"20.0.0+my-package",
17+
"99999.0.0+my-package",
18+
"99999.0.0-alpha.1+my-package",
19+
] {
20+
cargo_test_support::registry::Package::new("my-package", ver).publish();
21+
}
22+
23+
let project = Project::from_template(current_dir!().join("in"));
24+
let project_root = project.root();
25+
let cwd = &project_root;
26+
27+
snapbox::cmd::Command::cargo_ui()
28+
.masquerade_as_nightly_cargo(&["script"])
29+
.arg("-Zscript")
30+
.arg("add")
31+
.arg_line("--manifest-path cargo-test-fixture.rs my-package")
32+
.current_dir(cwd)
33+
.assert()
34+
.failure()
35+
.stdout_eq(str![""])
36+
.stderr_eq(file!["stderr.term.svg"]);
37+
38+
assert_ui().subset_matches(current_dir!().join("out"), &project_root);
39+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn main() {}
Lines changed: 50 additions & 0 deletions
Loading
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
[package]
3+
edition = "2015"
4+
---
5+
6+
fn main() {
7+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
use cargo_test_support::compare::assert_ui;
2+
use cargo_test_support::current_dir;
3+
use cargo_test_support::file;
4+
use cargo_test_support::prelude::*;
5+
use cargo_test_support::str;
6+
use cargo_test_support::Project;
7+
8+
#[cargo_test]
9+
fn case() {
10+
cargo_test_support::registry::init();
11+
for ver in [
12+
"0.1.1+my-package",
13+
"0.2.0+my-package",
14+
"0.2.3+my-package",
15+
"0.4.1+my-package",
16+
"20.0.0+my-package",
17+
"99999.0.0+my-package",
18+
"99999.0.0-alpha.1+my-package",
19+
] {
20+
cargo_test_support::registry::Package::new("my-package", ver).publish();
21+
}
22+
23+
let project = Project::from_template(current_dir!().join("in"));
24+
let project_root = project.root();
25+
let cwd = &project_root;
26+
27+
snapbox::cmd::Command::cargo_ui()
28+
.masquerade_as_nightly_cargo(&["script"])
29+
.arg("-Zscript")
30+
.arg("add")
31+
.arg_line("--manifest-path cargo-test-fixture.rs my-package")
32+
.current_dir(cwd)
33+
.assert()
34+
.failure()
35+
.stdout_eq(str![""])
36+
.stderr_eq(file!["stderr.term.svg"]);
37+
38+
assert_ui().subset_matches(current_dir!().join("out"), &project_root);
39+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
[package]
3+
edition = "2015"
4+
---
5+
6+
fn main() {
7+
}
Lines changed: 47 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env cargo
2+
3+
fn main() {}

0 commit comments

Comments
 (0)