Skip to content

Commit

Permalink
Add two tests to make sure fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
LuuuXXX committed Feb 21, 2024
1 parent e7ff7a6 commit 4b1fc88
Show file tree
Hide file tree
Showing 21 changed files with 117 additions and 0 deletions.
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"
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"files":{}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[workspace]

[package]
name = "aa"
version = "0.0.0"
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);
}
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" }
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.
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"
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"files":{}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[workspace]

[package]
name = "aa"
version = "0.0.0"
Empty file.
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);
}
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"
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.
2 changes: 2 additions & 0 deletions tests/testsuite/cargo_add/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
mod add_basic;
mod add_multiple;
mod add_no_vendored_package_with_alter_registry;
mod add_no_vendored_package_with_vendor;
mod add_normalized_name_external;
mod add_toolchain;
mod build;
Expand Down

0 comments on commit 4b1fc88

Please sign in to comment.