-
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.
test: migrate all test from cargo-information
- Loading branch information
1 parent
c76c8fd
commit 9d164aa
Showing
188 changed files
with
4,076 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
use cargo_test_support::file; | ||
use cargo_test_support::prelude::*; | ||
|
||
use super::init_registry_without_token; | ||
|
||
#[cargo_test] | ||
fn case() { | ||
init_registry_without_token(); | ||
cargo_test_support::registry::Package::new("my-package", "0.1.0") | ||
.file( | ||
"Cargo.toml", | ||
r#" | ||
[package] | ||
name = "my-package" | ||
version = "0.1.0" | ||
description = "A package for testing" | ||
repository = "https://github.com/hi-rustin/cargo-infromation" | ||
documentation = "https://docs.rs/my-package/0.1.0" | ||
license = "MIT" | ||
edition = "2018" | ||
rust-version = "1.50.0" | ||
keywords = ["foo", "bar", "baz"] | ||
[features] | ||
default = ["feature1"] | ||
feature1 = [] | ||
feature2 = [] | ||
[dependencies] | ||
foo = "0.1.0" | ||
bar = "0.2.0" | ||
baz = { version = "0.3.0", optional = true } | ||
[[bin]] | ||
name = "my_bin" | ||
[lib] | ||
name = "my_lib" | ||
"#, | ||
) | ||
.file("src/bin/my_bin.rs", "") | ||
.file("src/lib.rs", "") | ||
.publish(); | ||
|
||
snapbox::cmd::Command::cargo_ui() | ||
.arg("info") | ||
.arg("my-package") | ||
.arg("--registry=dummy-registry") | ||
.assert() | ||
.success() | ||
.stdout_eq(file!["stdout.term.svg"]) | ||
.stderr_eq(file!["stderr.term.svg"]); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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::file; | ||
use cargo_test_support::prelude::*; | ||
|
||
use super::init_registry_without_token; | ||
|
||
#[cargo_test] | ||
fn case() { | ||
init_registry_without_token(); | ||
cargo_test_support::registry::Package::new("my-package", "0.1.1") | ||
.feature("default", &["feature1", "feature2"]) | ||
.feature("feature1", &[]) | ||
.feature("feature2", &[]) | ||
.publish(); | ||
|
||
snapbox::cmd::Command::cargo_ui() | ||
.arg("info") | ||
.arg("my-package") | ||
.arg("--registry=dummy-registry") | ||
.assert() | ||
.success() | ||
.stdout_eq(file!["stdout.term.svg"]) | ||
.stderr_eq(file!["stderr.term.svg"]); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions
36
tests/testsuite/cargo_info/features_activated_over_limit/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,36 @@ | ||
use cargo_test_support::file; | ||
use cargo_test_support::prelude::*; | ||
|
||
use super::init_registry_without_token; | ||
|
||
#[cargo_test] | ||
fn case() { | ||
const MANY_FEATURES_COUNT: usize = 200; | ||
const DEFAULT_FEATURES_COUNT: usize = 100; | ||
|
||
init_registry_without_token(); | ||
let mut test_package = | ||
cargo_test_support::registry::Package::new("your-face", "99999.0.0+my-package"); | ||
let features = (0..MANY_FEATURES_COUNT) | ||
.map(|i| format!("eyes{i:03}")) | ||
.collect::<Vec<_>>(); | ||
for name in &features { | ||
test_package.feature(name.as_str(), &[]); | ||
} | ||
let default_features = features | ||
.iter() | ||
.take(DEFAULT_FEATURES_COUNT) | ||
.map(|s| s.as_str()) | ||
.collect::<Vec<_>>(); | ||
test_package.feature("default", &default_features); | ||
test_package.publish(); | ||
|
||
snapbox::cmd::Command::cargo_ui() | ||
.arg("info") | ||
.arg("your-face") | ||
.arg("--registry=dummy-registry") | ||
.assert() | ||
.success() | ||
.stdout_eq(file!["stdout.term.svg"]) | ||
.stderr_eq(file!["stderr.term.svg"]); | ||
} |
31 changes: 31 additions & 0 deletions
31
tests/testsuite/cargo_info/features_activated_over_limit/stderr.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions
43
tests/testsuite/cargo_info/features_activated_over_limit/stdout.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions
37
tests/testsuite/cargo_info/features_activated_over_limit_verbose/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,37 @@ | ||
use cargo_test_support::file; | ||
use cargo_test_support::prelude::*; | ||
|
||
use super::init_registry_without_token; | ||
|
||
#[cargo_test] | ||
fn case() { | ||
const MANY_FEATURES_COUNT: usize = 200; | ||
const DEFAULT_FEATURES_COUNT: usize = 100; | ||
|
||
init_registry_without_token(); | ||
let mut test_package = | ||
cargo_test_support::registry::Package::new("your-face", "99999.0.0+my-package"); | ||
let features = (0..MANY_FEATURES_COUNT) | ||
.map(|i| format!("eyes{i:03}")) | ||
.collect::<Vec<_>>(); | ||
for name in &features { | ||
test_package.feature(name.as_str(), &[]); | ||
} | ||
let default_features = features | ||
.iter() | ||
.take(DEFAULT_FEATURES_COUNT) | ||
.map(|s| s.as_str()) | ||
.collect::<Vec<_>>(); | ||
test_package.feature("default", &default_features); | ||
test_package.publish(); | ||
|
||
snapbox::cmd::Command::cargo_ui() | ||
.arg("info") | ||
.arg("your-face") | ||
.arg("--verbose") | ||
.arg("--registry=dummy-registry") | ||
.assert() | ||
.success() | ||
.stdout_eq(file!["stdout.term.svg"]) | ||
.stderr_eq(file!["stderr.term.svg"]); | ||
} |
Oops, something went wrong.