|
| 1 | +use crate::prelude::*; |
| 2 | +use cargo_test_support::file; |
| 3 | + |
| 4 | +use super::init_registry_without_token; |
| 5 | + |
| 6 | +#[cargo_test] |
| 7 | +fn case() { |
| 8 | + init_registry_without_token(); |
| 9 | + cargo_test_support::registry::Package::new("my-package", "0.1.0") |
| 10 | + .file( |
| 11 | + "Cargo.toml", |
| 12 | + r#" |
| 13 | + [package] |
| 14 | + name = "my-package" |
| 15 | + version = "0.1.0" |
| 16 | + description = "A package for testing" |
| 17 | + repository = "https://github.com/hi-rustin/cargo-infromation" |
| 18 | + documentation = "https://docs.rs/my-package/0.1.0" |
| 19 | + license = "MIT" |
| 20 | + edition = "2018" |
| 21 | + rust-version = "1.50.0" |
| 22 | + keywords = ["foo", "bar", "baz"] |
| 23 | +
|
| 24 | + [features] |
| 25 | + default = ["feature1"] |
| 26 | + feature1 = [] |
| 27 | + feature2 = [] |
| 28 | +
|
| 29 | + [dependencies] |
| 30 | + foo = "0.1.0" |
| 31 | + bar = "0.2.0" |
| 32 | + baz = { version = "0.3.0", optional = true } |
| 33 | +
|
| 34 | + [[bin]] |
| 35 | + name = "my_bin" |
| 36 | +
|
| 37 | + [lib] |
| 38 | + name = "my_lib" |
| 39 | + "#, |
| 40 | + ) |
| 41 | + .file("src/bin/my_bin.rs", "") |
| 42 | + .file("src/lib.rs", "") |
| 43 | + .publish(); |
| 44 | + cargo_test_support::registry::Package::new("my_crate", "0.1.0") |
| 45 | + .file( |
| 46 | + "Cargo.toml", |
| 47 | + r#" |
| 48 | + [package] |
| 49 | + name = "my_crate" |
| 50 | + version = "0.1.0" |
| 51 | + description = "A package for testing" |
| 52 | + repository = "https://github.com/hi-rustin/cargo-infromation" |
| 53 | + documentation = "https://docs.rs/my-package/0.1.0" |
| 54 | + license = "MIT" |
| 55 | + edition = "2018" |
| 56 | + rust-version = "1.50.0" |
| 57 | + keywords = ["foo", "bar", "baz"] |
| 58 | +
|
| 59 | + [features] |
| 60 | + default = ["feature1"] |
| 61 | + feature1 = [] |
| 62 | + feature2 = [] |
| 63 | +
|
| 64 | + [dependencies] |
| 65 | + foo = "0.1.0" |
| 66 | + bar = "0.2.0" |
| 67 | + baz = { version = "0.3.0", optional = true } |
| 68 | +
|
| 69 | + [[bin]] |
| 70 | + name = "my_bin" |
| 71 | +
|
| 72 | + [lib] |
| 73 | + name = "my_lib" |
| 74 | + "#, |
| 75 | + ) |
| 76 | + .file("src/bin/my_bin.rs", "") |
| 77 | + .file("src/lib.rs", "") |
| 78 | + .publish(); |
| 79 | + |
| 80 | + snapbox::cmd::Command::cargo_ui() |
| 81 | + .arg("info") |
| 82 | + .arg("my_package") //underscore on purpose to show the error |
| 83 | + .arg("--registry=dummy-registry") |
| 84 | + .assert() |
| 85 | + .failure() |
| 86 | + .stdout_eq(file!["stdout1.term.svg"]) |
| 87 | + .stderr_eq(file!["stderr1.term.svg"]); |
| 88 | + |
| 89 | + snapbox::cmd::Command::cargo_ui() |
| 90 | + .arg("info") |
| 91 | + .arg("my-crate") //hyphen on purpose to show the error |
| 92 | + .arg("--registry=dummy-registry") |
| 93 | + .assert() |
| 94 | + .failure() |
| 95 | + .stdout_eq(file!["stdout2.term.svg"]) |
| 96 | + .stderr_eq(file!["stderr2.term.svg"]); |
| 97 | +} |
0 commit comments