|
| 1 | +use cargo_test_support::compare::assert_ui; |
| 2 | +use cargo_test_support::paths; |
| 3 | +use cargo_test_support::prelude::*; |
| 4 | +use cargo_test_support::ProjectBuilder; |
| 5 | + |
| 6 | +use cargo_test_support::curr_dir; |
| 7 | + |
| 8 | +#[cargo_test] |
| 9 | +fn case() { |
| 10 | + cargo_test_support::registry::alt_init(); |
| 11 | + cargo_test_support::registry::Package::new("linked-hash-map", "0.5.4") |
| 12 | + .feature("clippy", &[]) |
| 13 | + .feature("heapsize", &[]) |
| 14 | + .feature("heapsize_impl", &[]) |
| 15 | + .feature("nightly", &[]) |
| 16 | + .feature("serde", &[]) |
| 17 | + .feature("serde_impl", &[]) |
| 18 | + .feature("serde_test", &[]) |
| 19 | + .alternative(true) |
| 20 | + .publish(); |
| 21 | + |
| 22 | + let project = ProjectBuilder::new(paths::root().join("in")) |
| 23 | + .file( |
| 24 | + ".cargo/config.toml", |
| 25 | + r#"[source.crates-io] |
| 26 | +replace-with = "vendored-sources" |
| 27 | +
|
| 28 | +[source.vendored-sources] |
| 29 | +directory = "./vendor" |
| 30 | +"#, |
| 31 | + ) |
| 32 | + .file("src/lib.rs", "") |
| 33 | + .file( |
| 34 | + "Cargo.toml", |
| 35 | + r#"[workspace] |
| 36 | +
|
| 37 | +[package] |
| 38 | +name = "cargo-list-test-fixture" |
| 39 | +version = "0.0.0" |
| 40 | +"#, |
| 41 | + ) |
| 42 | + .build(); |
| 43 | + let project_root = project.root(); |
| 44 | + let cwd = &project_root; |
| 45 | + |
| 46 | + snapbox::cmd::Command::cargo_ui() |
| 47 | + .arg("add") |
| 48 | + .arg_line("linked_hash_map --registry alternative") |
| 49 | + .current_dir(cwd) |
| 50 | + .assert() |
| 51 | + .success() |
| 52 | + .stdout_matches_path(curr_dir!().join("stdout.log")) |
| 53 | + .stderr_matches_path(curr_dir!().join("stderr.log")); |
| 54 | + |
| 55 | + assert_ui().subset_matches(curr_dir!().join("out"), &project_root); |
| 56 | +} |
0 commit comments