-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(add): improve error when adding registry packages while vendored
- Loading branch information
Showing
28 changed files
with
134 additions
and
10 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
5 changes: 5 additions & 0 deletions
5
tests/testsuite/cargo_add/add_no_vendored_package_with_alter_registry/in/.cargo/config.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 @@ | ||
[source.crates-io] | ||
replace-with = "vendored-sources" | ||
|
||
[source.vendored-sources] | ||
directory = "./vendor" |
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.
1 change: 1 addition & 0 deletions
1
...e/cargo_add/add_no_vendored_package_with_alter_registry/in/vendor/aa/.cargo-checksum.json
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 @@ | ||
{"files":{}} |
5 changes: 5 additions & 0 deletions
5
...s/testsuite/cargo_add/add_no_vendored_package_with_alter_registry/in/vendor/aa/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 = "aa" | ||
version = "0.0.0" |
Empty file.
35 changes: 35 additions & 0 deletions
35
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,35 @@ | ||
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::Project; | ||
|
||
#[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 = 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("linked_hash_map --registry alternative") | ||
.current_dir(cwd) | ||
.assert() | ||
.success() | ||
.stdout_matches(file!["stdout.log"]) | ||
.stderr_matches(file!["stderr.log"]); | ||
|
||
assert_ui().subset_matches(current_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/config.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 @@ | ||
[source.crates-io] | ||
replace-with = "vendored-sources" | ||
|
||
[source.vendored-sources] | ||
directory = "./vendor" |
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.
1 change: 1 addition & 0 deletions
1
...testsuite/cargo_add/add_no_vendored_package_with_vendor/in/vendor/aa/.cargo-checksum.json
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 @@ | ||
{"files":{}} |
5 changes: 5 additions & 0 deletions
5
tests/testsuite/cargo_add/add_no_vendored_package_with_vendor/in/vendor/aa/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 = "aa" | ||
version = "0.0.0" |
Empty file.
23 changes: 23 additions & 0 deletions
23
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,23 @@ | ||
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::Project; | ||
|
||
#[cargo_test] | ||
fn case() { | ||
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("cbindgen") | ||
.current_dir(cwd) | ||
.assert() | ||
.failure() | ||
.stdout_matches(file!["stdout.log"]) | ||
.stderr_matches(file!["stderr.log"]); | ||
|
||
assert_ui().subset_matches(current_dir!().join("out"), &project_root); | ||
} |
5 changes: 5 additions & 0 deletions
5
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,5 @@ | ||
[workspace] | ||
|
||
[package] | ||
name = "cargo-list-test-fixture" | ||
version = "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