Skip to content

Commit 5b90c4b

Browse files
committed
add tests for preserve features sorted and usorted
1 parent a59aba1 commit 5b90c4b

File tree

11 files changed

+190
-0
lines changed

11 files changed

+190
-0
lines changed

tests/testsuite/cargo_add/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ mod path_inferred_name;
111111
mod path_inferred_name_conflicts_full_feature;
112112
mod path_normalized_name;
113113
mod preserve_dep_std_table;
114+
mod preserve_features_sorted;
114115
mod preserve_features_table;
116+
mod preserve_features_unsorted;
115117
mod preserve_sorted;
116118
mod preserve_unsorted;
117119
mod public;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[workspace]
2+
3+
[package]
4+
name = "cargo-list-test-fixture"
5+
version = "0.0.0"
6+
edition = "2015"
7+
8+
[dependencies]
9+
my-package = { version = "99999.0.0", features = ["a", "b", "c", "e"] }

tests/testsuite/cargo_add/preserve_features_sorted/in/src/lib.rs

Whitespace-only changes.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
cargo_test_support::registry::Package::new("my-package", "99999.0.0+my-package")
12+
.feature("a", &[])
13+
.feature("b", &[])
14+
.feature("c", &[])
15+
.feature("d", &[])
16+
.feature("e", &[])
17+
.publish();
18+
19+
let project = Project::from_template(current_dir!().join("in"));
20+
let project_root = project.root();
21+
let cwd = &project_root;
22+
23+
snapbox::cmd::Command::cargo_ui()
24+
.arg("add")
25+
.arg_line("my-package -F d")
26+
.current_dir(cwd)
27+
.assert()
28+
.success()
29+
.stdout_matches(str![""])
30+
.stderr_matches(file!["stderr.term.svg"]);
31+
32+
assert_ui().subset_matches(current_dir!().join("out"), &project_root);
33+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[workspace]
2+
3+
[package]
4+
name = "cargo-list-test-fixture"
5+
version = "0.0.0"
6+
edition = "2015"
7+
8+
[dependencies]
9+
my-package = { version = "99999.0.0", features = ["a", "b", "c", "e", "d"] }
Lines changed: 43 additions & 0 deletions
Loading
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[workspace]
2+
3+
[package]
4+
name = "cargo-list-test-fixture"
5+
version = "0.0.0"
6+
edition = "2015"
7+
8+
[dependencies]
9+
my-package = { version = "99999.0.0", features = ["b", "a", "d", "c"] }

tests/testsuite/cargo_add/preserve_features_unsorted/in/src/lib.rs

Whitespace-only changes.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
cargo_test_support::registry::Package::new("my-package", "99999.0.0+my-package")
12+
.feature("a", &[])
13+
.feature("b", &[])
14+
.feature("c", &[])
15+
.feature("d", &[])
16+
.feature("e", &[])
17+
.publish();
18+
19+
let project = Project::from_template(current_dir!().join("in"));
20+
let project_root = project.root();
21+
let cwd = &project_root;
22+
23+
snapbox::cmd::Command::cargo_ui()
24+
.arg("add")
25+
.arg_line("my-package -F e")
26+
.current_dir(cwd)
27+
.assert()
28+
.success()
29+
.stdout_matches(str![""])
30+
.stderr_matches(file!["stderr.term.svg"]);
31+
32+
assert_ui().subset_matches(current_dir!().join("out"), &project_root);
33+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[workspace]
2+
3+
[package]
4+
name = "cargo-list-test-fixture"
5+
version = "0.0.0"
6+
edition = "2015"
7+
8+
[dependencies]
9+
my-package = { version = "99999.0.0", features = ["b", "a", "d", "c", "e"] }

0 commit comments

Comments
 (0)