Skip to content

chore(test): remove unnecesary packages and versions for optionals tests #13108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/testsuite/cargo_add/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ mod overwrite_no_public;
mod overwrite_no_public_with_public;
mod overwrite_optional;
mod overwrite_optional_with_no_optional;
mod overwrite_optional_with_optional;
mod overwrite_path_noop;
mod overwrite_path_with_version;
mod overwrite_preserves_inline_table;
Expand Down
16 changes: 2 additions & 14 deletions tests/testsuite/cargo_add/no_optional/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,15 @@ use cargo_test_support::curr_dir;
#[cargo_test]
fn case() {
cargo_test_support::registry::init();
for name in ["my-package1", "my-package2"] {
for ver in [
"0.1.1+my-package",
"0.2.0+my-package",
"0.2.3+my-package",
"0.4.1+my-package",
"20.0.0+my-package",
"99999.0.0+my-package",
"99999.0.0-alpha.1+my-package",
] {
cargo_test_support::registry::Package::new(name, ver).publish();
}
}
cargo_test_support::registry::Package::new("my-package", "0.1.0").publish();

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

snapbox::cmd::Command::cargo_ui()
.arg("add")
.arg_line("my-package1 [email protected] --no-optional")
.arg_line("my-package --no-optional")
.current_dir(cwd)
.assert()
.success()
Expand Down
3 changes: 1 addition & 2 deletions tests/testsuite/cargo_add/no_optional/out/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ name = "cargo-list-test-fixture"
version = "0.0.0"

[dependencies]
my-package1 = "99999.0.0"
my-package2 = "0.4.1"
my-package = "0.1.0"
3 changes: 1 addition & 2 deletions tests/testsuite/cargo_add/no_optional/stderr.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Updating `dummy-registry` index
Adding my-package1 v99999.0.0 to dependencies.
Adding my-package2 v0.4.1 to dependencies.
Adding my-package v0.1.0 to dependencies.
16 changes: 2 additions & 14 deletions tests/testsuite/cargo_add/optional/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,15 @@ use cargo_test_support::curr_dir;
#[cargo_test]
fn case() {
cargo_test_support::registry::init();
for name in ["my-package1", "my-package2"] {
for ver in [
"0.1.1+my-package",
"0.2.0+my-package",
"0.2.3+my-package",
"0.4.1+my-package",
"20.0.0+my-package",
"99999.0.0+my-package",
"99999.0.0-alpha.1+my-package",
] {
cargo_test_support::registry::Package::new(name, ver).publish();
}
}
cargo_test_support::registry::Package::new("my-package", "0.1.0").publish();

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

snapbox::cmd::Command::cargo_ui()
.arg("add")
.arg_line("my-package1 [email protected] --optional")
.arg_line("my-package --optional")
.current_dir(cwd)
.assert()
.success()
Expand Down
6 changes: 2 additions & 4 deletions tests/testsuite/cargo_add/optional/out/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ name = "cargo-list-test-fixture"
version = "0.0.0"

[dependencies]
my-package1 = { version = "99999.0.0", optional = true }
my-package2 = { version = "0.4.1", optional = true }
my-package = { version = "0.1.0", optional = true }

[features]
my-package1 = ["dep:my-package1"]
my-package2 = ["dep:my-package2"]
my-package = ["dep:my-package"]
3 changes: 1 addition & 2 deletions tests/testsuite/cargo_add/optional/stderr.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Updating `dummy-registry` index
Adding my-package1 v99999.0.0 to optional dependencies.
Adding my-package2 v0.4.1 to optional dependencies.
Adding my-package v0.1.0 to optional dependencies.
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ name = "cargo-list-test-fixture"
version = "0.0.0"

[dependencies]
my-package1 = "99999.0.0"
my-package2 = "0.4.1"
my-package = "0.1.0"
16 changes: 2 additions & 14 deletions tests/testsuite/cargo_add/overwrite_no_optional/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,15 @@ use cargo_test_support::curr_dir;
#[cargo_test]
fn case() {
cargo_test_support::registry::init();
for name in ["my-package1", "my-package2"] {
for ver in [
"0.1.1+my-package",
"0.2.0+my-package",
"0.2.3+my-package",
"0.4.1+my-package",
"20.0.0+my-package",
"99999.0.0+my-package",
"99999.0.0-alpha.1+my-package",
] {
cargo_test_support::registry::Package::new(name, ver).publish();
}
}
cargo_test_support::registry::Package::new("my-package", "0.1.0").publish();

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

snapbox::cmd::Command::cargo_ui()
.arg("add")
.arg_line("my-package1 [email protected] --no-optional")
.arg_line("my-package --no-optional")
.current_dir(cwd)
.assert()
.success()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ name = "cargo-list-test-fixture"
version = "0.0.0"

[dependencies]
my-package1 = "99999.0.0"
my-package2 = "0.4.1"
my-package = "0.1.0"
3 changes: 1 addition & 2 deletions tests/testsuite/cargo_add/overwrite_no_optional/stderr.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Updating `dummy-registry` index
Adding my-package1 v99999.0.0 to dependencies.
Adding my-package2 v0.4.1 to dependencies.
Adding my-package v0.1.0 to dependencies.
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ name = "cargo-list-test-fixture"
version = "0.0.0"

[dependencies]
my-package1 = { version = "99999.0.0", optional = false }
my-package2 = { version = "0.4.1", optional = false }
my-package = { version = "0.1.0", optional = false }
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,15 @@ use cargo_test_support::curr_dir;
#[cargo_test]
fn case() {
cargo_test_support::registry::init();
for name in ["my-package1", "my-package2"] {
for ver in [
"0.1.1+my-package",
"0.2.0+my-package",
"0.2.3+my-package",
"0.4.1+my-package",
"20.0.0+my-package",
"99999.0.0+my-package",
"99999.0.0-alpha.1+my-package",
] {
cargo_test_support::registry::Package::new(name, ver).publish();
}
}
cargo_test_support::registry::Package::new("my-package", "0.1.0").publish();

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

snapbox::cmd::Command::cargo_ui()
.arg("add")
.arg_line("my-package1 [email protected] --optional")
.arg_line("my-package --optional")
.current_dir(cwd)
.assert()
.success()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ name = "cargo-list-test-fixture"
version = "0.0.0"

[dependencies]
my-package1 = { version = "99999.0.0", optional = true }
my-package2 = { version = "0.4.1", optional = true }
my-package = { version = "0.1.0", optional = true }

[features]
my-package1 = ["dep:my-package1"]
my-package2 = ["dep:my-package2"]
my-package = ["dep:my-package"]
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Updating `dummy-registry` index
Adding my-package1 v99999.0.0 to optional dependencies.
Adding my-package2 v0.4.1 to optional dependencies.
Adding my-package v0.1.0 to optional dependencies.
3 changes: 1 addition & 2 deletions tests/testsuite/cargo_add/overwrite_optional/in/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ name = "cargo-list-test-fixture"
version = "0.0.0"

[dependencies]
my-package1 = "99999.0.0"
my-package2 = "0.4.1"
my-package = "0.1.0"
16 changes: 2 additions & 14 deletions tests/testsuite/cargo_add/overwrite_optional/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,15 @@ use cargo_test_support::curr_dir;
#[cargo_test]
fn case() {
cargo_test_support::registry::init();
for name in ["my-package1", "my-package2"] {
for ver in [
"0.1.1+my-package",
"0.2.0+my-package",
"0.2.3+my-package",
"0.4.1+my-package",
"20.0.0+my-package",
"99999.0.0+my-package",
"99999.0.0-alpha.1+my-package",
] {
cargo_test_support::registry::Package::new(name, ver).publish();
}
}
cargo_test_support::registry::Package::new("my-package", "0.1.0").publish();

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

snapbox::cmd::Command::cargo_ui()
.arg("add")
.arg_line("my-package1 [email protected] --optional")
.arg_line("my-package --optional")
.current_dir(cwd)
.assert()
.success()
Expand Down
6 changes: 2 additions & 4 deletions tests/testsuite/cargo_add/overwrite_optional/out/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ name = "cargo-list-test-fixture"
version = "0.0.0"

[dependencies]
my-package1 = { version = "99999.0.0", optional = true }
my-package2 = { version = "0.4.1", optional = true }
my-package = { version = "0.1.0", optional = true }

[features]
my-package1 = ["dep:my-package1"]
my-package2 = ["dep:my-package2"]
my-package = ["dep:my-package"]
3 changes: 1 addition & 2 deletions tests/testsuite/cargo_add/overwrite_optional/stderr.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Updating `dummy-registry` index
Adding my-package1 v99999.0.0 to optional dependencies.
Adding my-package2 v0.4.1 to optional dependencies.
Adding my-package v0.1.0 to optional dependencies.
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ other = ["your-face/nose"]

[dependencies]
your-face = { version = "99999.0.0", optional = true }
my-package2 = { version = "0.4.1", optional = true }
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,7 @@ use cargo_test_support::curr_dir;
#[cargo_test]
fn case() {
cargo_test_support::registry::init();
for ver in [
"0.1.1+my-package",
"0.2.0+my-package",
"0.2.3+my-package",
"0.4.1+my-package",
"20.0.0+my-package",
"99999.0.0+my-package",
"99999.0.0-alpha.1+my-package",
] {
cargo_test_support::registry::Package::new("my-package2", ver).publish();
}

cargo_test_support::registry::Package::new("your-face", "99999.0.0+my-package")
.feature("nose", &[])
.feature("mouth", &[])
Expand All @@ -31,7 +21,7 @@ fn case() {

snapbox::cmd::Command::cargo_ui()
.arg("add")
.arg_line("your-face [email protected] --no-optional")
.arg_line("your-face --no-optional")
.current_dir(cwd)
.assert()
.success()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ other = ["your-face/nose"]

[dependencies]
your-face = { version = "99999.0.0" }
my-package2 = { version = "0.4.1" }
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
- eyes
- mouth
- nose
Adding my-package2 v0.4.1 to dependencies.
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,7 @@ use cargo_test_support::curr_dir;
#[cargo_test]
fn case() {
cargo_test_support::registry::init();
for ver in [
"0.1.1+my-package",
"0.2.0+my-package",
"0.2.3+my-package",
"0.4.1+my-package",
"20.0.0+my-package",
"99999.0.0+my-package",
"99999.0.0-alpha.1+my-package",
] {
cargo_test_support::registry::Package::new("my-package1", ver).publish();
}
cargo_test_support::registry::Package::new("my-package1", "99999.0.0").publish();

let project = Project::from_template(curr_dir!().join("in"));
let project_root = project.root();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Updating `dummy-registry` index
Adding my-package1 v99999.0.0 to optional dependencies.
Adding my-package2 v0.4.1 to optional dependencies.