Skip to content

Commit

Permalink
add tests for preserve features sorted and usorted
Browse files Browse the repository at this point in the history
  • Loading branch information
Flowrey committed Apr 1, 2024
1 parent a59aba1 commit 5b90c4b
Show file tree
Hide file tree
Showing 11 changed files with 190 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/testsuite/cargo_add/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ mod path_inferred_name;
mod path_inferred_name_conflicts_full_feature;
mod path_normalized_name;
mod preserve_dep_std_table;
mod preserve_features_sorted;
mod preserve_features_table;
mod preserve_features_unsorted;
mod preserve_sorted;
mod preserve_unsorted;
mod public;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[workspace]

[package]
name = "cargo-list-test-fixture"
version = "0.0.0"
edition = "2015"

[dependencies]
my-package = { version = "99999.0.0", features = ["a", "b", "c", "e"] }
Empty file.
33 changes: 33 additions & 0 deletions tests/testsuite/cargo_add/preserve_features_sorted/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
fn case() {
cargo_test_support::registry::init();
cargo_test_support::registry::Package::new("my-package", "99999.0.0+my-package")
.feature("a", &[])
.feature("b", &[])
.feature("c", &[])
.feature("d", &[])
.feature("e", &[])
.publish();

let project = Project::from_template(current_dir!().join("in"));
let project_root = project.root();
let cwd = &project_root;

snapbox::cmd::Command::cargo_ui()
.arg("add")
.arg_line("my-package -F d")
.current_dir(cwd)
.assert()
.success()
.stdout_matches(str![""])
.stderr_matches(file!["stderr.term.svg"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[workspace]

[package]
name = "cargo-list-test-fixture"
version = "0.0.0"
edition = "2015"

[dependencies]
my-package = { version = "99999.0.0", features = ["a", "b", "c", "e", "d"] }
43 changes: 43 additions & 0 deletions tests/testsuite/cargo_add/preserve_features_sorted/stderr.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[workspace]

[package]
name = "cargo-list-test-fixture"
version = "0.0.0"
edition = "2015"

[dependencies]
my-package = { version = "99999.0.0", features = ["b", "a", "d", "c"] }
Empty file.
33 changes: 33 additions & 0 deletions tests/testsuite/cargo_add/preserve_features_unsorted/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
fn case() {
cargo_test_support::registry::init();
cargo_test_support::registry::Package::new("my-package", "99999.0.0+my-package")
.feature("a", &[])
.feature("b", &[])
.feature("c", &[])
.feature("d", &[])
.feature("e", &[])
.publish();

let project = Project::from_template(current_dir!().join("in"));
let project_root = project.root();
let cwd = &project_root;

snapbox::cmd::Command::cargo_ui()
.arg("add")
.arg_line("my-package -F e")
.current_dir(cwd)
.assert()
.success()
.stdout_matches(str![""])
.stderr_matches(file!["stderr.term.svg"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[workspace]

[package]
name = "cargo-list-test-fixture"
version = "0.0.0"
edition = "2015"

[dependencies]
my-package = { version = "99999.0.0", features = ["b", "a", "d", "c", "e"] }
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5b90c4b

Please sign in to comment.