-
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.
Add tests to ensure this issue is fixed
- Loading branch information
Showing
13 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
tests/testsuite/cargo_add/add_no_vendored_package_with_alter_registry/in/Cargo.toml
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[workspace] | ||
|
||
[package] | ||
name = "cargo-list-test-fixture" | ||
version = "0.0.0" |
Empty file.
56 changes: 56 additions & 0 deletions
56
tests/testsuite/cargo_add/add_no_vendored_package_with_alter_registry/mod.rs
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
use cargo_test_support::compare::assert_ui; | ||
use cargo_test_support::paths; | ||
use cargo_test_support::prelude::*; | ||
use cargo_test_support::ProjectBuilder; | ||
|
||
use cargo_test_support::curr_dir; | ||
|
||
#[cargo_test] | ||
fn case() { | ||
cargo_test_support::registry::alt_init(); | ||
cargo_test_support::registry::Package::new("linked-hash-map", "0.5.4") | ||
.feature("clippy", &[]) | ||
.feature("heapsize", &[]) | ||
.feature("heapsize_impl", &[]) | ||
.feature("nightly", &[]) | ||
.feature("serde", &[]) | ||
.feature("serde_impl", &[]) | ||
.feature("serde_test", &[]) | ||
.alternative(true) | ||
.publish(); | ||
|
||
let project = ProjectBuilder::new(paths::root().join("in")) | ||
.file( | ||
".cargo/config.toml", | ||
r#"[source.crates-io] | ||
replace-with = "vendored-sources" | ||
[source.vendored-sources] | ||
directory = "./vendor" | ||
"#, | ||
) | ||
.file("src/lib.rs", "") | ||
.file( | ||
"Cargo.toml", | ||
r#"[workspace] | ||
[package] | ||
name = "cargo-list-test-fixture" | ||
version = "0.0.0" | ||
"#, | ||
) | ||
.build(); | ||
let project_root = project.root(); | ||
let cwd = &project_root; | ||
|
||
snapbox::cmd::Command::cargo_ui() | ||
.arg("add") | ||
.arg_line("linked_hash_map --registry alternative") | ||
.current_dir(cwd) | ||
.assert() | ||
.success() | ||
.stdout_matches_path(curr_dir!().join("stdout.log")) | ||
.stderr_matches_path(curr_dir!().join("stderr.log")); | ||
|
||
assert_ui().subset_matches(curr_dir!().join("out"), &project_root); | ||
} |
8 changes: 8 additions & 0 deletions
8
tests/testsuite/cargo_add/add_no_vendored_package_with_alter_registry/out/Cargo.toml
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[workspace] | ||
|
||
[package] | ||
name = "cargo-list-test-fixture" | ||
version = "0.0.0" | ||
|
||
[dependencies] | ||
linked-hash-map = { version = "0.5.4", registry = "alternative" } |
11 changes: 11 additions & 0 deletions
11
tests/testsuite/cargo_add/add_no_vendored_package_with_alter_registry/stderr.log
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Updating `alternative` index | ||
warning: translating `linked_hash_map` to `linked-hash-map` | ||
Adding linked-hash-map v0.5.4 to dependencies. | ||
Features: | ||
- clippy | ||
- heapsize | ||
- heapsize_impl | ||
- nightly | ||
- serde | ||
- serde_impl | ||
- serde_test |
Empty file.
5 changes: 5 additions & 0 deletions
5
tests/testsuite/cargo_add/add_no_vendored_package_with_vendor/in/Cargo.toml
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[workspace] | ||
|
||
[package] | ||
name = "cargo-list-test-fixture" | ||
version = "0.0.0" |
Empty file.
55 changes: 55 additions & 0 deletions
55
tests/testsuite/cargo_add/add_no_vendored_package_with_vendor/mod.rs
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
use cargo_test_support::compare::assert_ui; | ||
use cargo_test_support::paths; | ||
use cargo_test_support::prelude::*; | ||
use cargo_test_support::ProjectBuilder; | ||
|
||
use cargo_test_support::curr_dir; | ||
|
||
#[cargo_test] | ||
fn case() { | ||
let project = ProjectBuilder::new(paths::root().join("in")) | ||
.file( | ||
".cargo/config.toml", | ||
r#"[source.crates-io] | ||
replace-with = "vendored-sources" | ||
[source.vendored-sources] | ||
directory = "./vendor" | ||
"#, | ||
) | ||
.file("vendor/aa/src/lib.rs", "") | ||
.file("vendor/aa/.cargo-checksum.json", "{\"files\":{}}") | ||
.file( | ||
"vendor/aa/Cargo.toml", | ||
r#"[workspace] | ||
[package] | ||
name = "aa" | ||
version = "0.0.0" | ||
"#, | ||
) | ||
.file("src/lib.rs", "") | ||
.file( | ||
"Cargo.toml", | ||
r#"[workspace] | ||
[package] | ||
name = "cargo-list-test-fixture" | ||
version = "0.0.0" | ||
"#, | ||
) | ||
.build(); | ||
let project_root = project.root(); | ||
let cwd = &project_root; | ||
|
||
snapbox::cmd::Command::cargo_ui() | ||
.arg("add") | ||
.arg_line("cbindgen") | ||
.current_dir(cwd) | ||
.assert() | ||
.success() | ||
.stdout_matches_path(curr_dir!().join("stdout.log")) | ||
.stderr_matches_path(curr_dir!().join("stderr.log")); | ||
|
||
assert_ui().subset_matches(curr_dir!().join("out"), &project_root); | ||
} |
8 changes: 8 additions & 0 deletions
8
tests/testsuite/cargo_add/add_no_vendored_package_with_vendor/out/Cargo.toml
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[workspace] | ||
|
||
[package] | ||
name = "cargo-list-test-fixture" | ||
version = "0.0.0" | ||
|
||
[dependencies] | ||
aa = "0.0.0" |
1 change: 1 addition & 0 deletions
1
tests/testsuite/cargo_add/add_no_vendored_package_with_vendor/stderr.log
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
error: the crate `cbindgen` could not be found in registry index. |
Empty file.
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