-
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.
Auto merge of #12662 - Angelin01:limit-cargo-add-feature-print, r=wei…
…hanglo Limit cargo add feature print
- Loading branch information
Showing
14 changed files
with
242 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
5 changes: 5 additions & 0 deletions
5
tests/testsuite/cargo_add/features_too_many_activated/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.
38 changes: 38 additions & 0 deletions
38
tests/testsuite/cargo_add/features_too_many_activated/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,38 @@ | ||
use cargo_test_support::compare::assert_ui; | ||
use cargo_test_support::prelude::*; | ||
use cargo_test_support::Project; | ||
use itertools::Itertools; | ||
|
||
use cargo_test_support::curr_dir; | ||
|
||
#[cargo_test] | ||
fn case() { | ||
const MANY_FEATURES_COUNT: usize = 200; | ||
const ACTIVATED_FEATURES_COUNT: usize = 100; | ||
|
||
cargo_test_support::registry::init(); | ||
let mut test_package = | ||
cargo_test_support::registry::Package::new("your-face", "99999.0.0+my-package"); | ||
for i in 0..MANY_FEATURES_COUNT { | ||
test_package.feature(format!("eyes{i:03}").as_str(), &[]); | ||
} | ||
test_package.publish(); | ||
|
||
let project = Project::from_template(curr_dir!().join("in")); | ||
let project_root = project.root(); | ||
let cwd = &project_root; | ||
|
||
let features = (0..ACTIVATED_FEATURES_COUNT) | ||
.map(|i| format!("eyes{i:03}")) | ||
.join(","); | ||
snapbox::cmd::Command::cargo_ui() | ||
.arg("add") | ||
.arg_line(format!("your-face --features {features}").as_str()) | ||
.current_dir(cwd) | ||
.assert() | ||
.success() | ||
.stdout_matches_path(curr_dir!().join("stdout.log")) | ||
.stderr_matches_path(curr_dir!().join("stderr.log")); | ||
|
||
assert_ui().subset_matches(curr_dir!().join("out"), &project_root); | ||
} |
8 changes: 8 additions & 0 deletions
8
tests/testsuite/cargo_add/features_too_many_activated/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] | ||
your-face = { version = "99999.0.0", features = ["eyes000", "eyes001", "eyes002", "eyes003", "eyes004", "eyes005", "eyes006", "eyes007", "eyes008", "eyes009", "eyes010", "eyes011", "eyes012", "eyes013", "eyes014", "eyes015", "eyes016", "eyes017", "eyes018", "eyes019", "eyes020", "eyes021", "eyes022", "eyes023", "eyes024", "eyes025", "eyes026", "eyes027", "eyes028", "eyes029", "eyes030", "eyes031", "eyes032", "eyes033", "eyes034", "eyes035", "eyes036", "eyes037", "eyes038", "eyes039", "eyes040", "eyes041", "eyes042", "eyes043", "eyes044", "eyes045", "eyes046", "eyes047", "eyes048", "eyes049", "eyes050", "eyes051", "eyes052", "eyes053", "eyes054", "eyes055", "eyes056", "eyes057", "eyes058", "eyes059", "eyes060", "eyes061", "eyes062", "eyes063", "eyes064", "eyes065", "eyes066", "eyes067", "eyes068", "eyes069", "eyes070", "eyes071", "eyes072", "eyes073", "eyes074", "eyes075", "eyes076", "eyes077", "eyes078", "eyes079", "eyes080", "eyes081", "eyes082", "eyes083", "eyes084", "eyes085", "eyes086", "eyes087", "eyes088", "eyes089", "eyes090", "eyes091", "eyes092", "eyes093", "eyes094", "eyes095", "eyes096", "eyes097", "eyes098", "eyes099"] } |
55 changes: 55 additions & 0 deletions
55
tests/testsuite/cargo_add/features_too_many_activated/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,55 @@ | ||
Updating `dummy-registry` index | ||
Adding your-face v99999.0.0 to dependencies. | ||
Features: | ||
+ eyes000 | ||
+ eyes001 | ||
+ eyes002 | ||
+ eyes003 | ||
+ eyes004 | ||
+ eyes005 | ||
+ eyes006 | ||
+ eyes007 | ||
+ eyes008 | ||
+ eyes009 | ||
+ eyes010 | ||
+ eyes011 | ||
+ eyes012 | ||
+ eyes013 | ||
+ eyes014 | ||
+ eyes015 | ||
+ eyes016 | ||
+ eyes017 | ||
+ eyes018 | ||
+ eyes019 | ||
+ eyes020 | ||
+ eyes021 | ||
+ eyes022 | ||
+ eyes023 | ||
+ eyes024 | ||
+ eyes025 | ||
+ eyes026 | ||
+ eyes027 | ||
+ eyes028 | ||
+ eyes029 | ||
+ eyes030 | ||
+ eyes031 | ||
+ eyes032 | ||
+ eyes033 | ||
+ eyes034 | ||
+ eyes035 | ||
+ eyes036 | ||
+ eyes037 | ||
+ eyes038 | ||
+ eyes039 | ||
+ eyes040 | ||
+ eyes041 | ||
+ eyes042 | ||
+ eyes043 | ||
+ eyes044 | ||
+ eyes045 | ||
+ eyes046 | ||
+ eyes047 | ||
+ eyes048 | ||
+ eyes049 | ||
... 50 more activated features | ||
... 100 more deactivated features |
Empty file.
5 changes: 5 additions & 0 deletions
5
tests/testsuite/cargo_add/features_too_many_few_activated/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.
38 changes: 38 additions & 0 deletions
38
tests/testsuite/cargo_add/features_too_many_few_activated/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,38 @@ | ||
use cargo_test_support::compare::assert_ui; | ||
use cargo_test_support::prelude::*; | ||
use cargo_test_support::Project; | ||
use itertools::Itertools; | ||
|
||
use cargo_test_support::curr_dir; | ||
|
||
#[cargo_test] | ||
fn case() { | ||
const MANY_FEATURES_COUNT: usize = 200; | ||
const ACTIVATED_FEATURES_COUNT: usize = 10; | ||
|
||
cargo_test_support::registry::init(); | ||
let mut test_package = | ||
cargo_test_support::registry::Package::new("your-face", "99999.0.0+my-package"); | ||
for i in 0..MANY_FEATURES_COUNT { | ||
test_package.feature(format!("eyes{i:03}").as_str(), &[]); | ||
} | ||
test_package.publish(); | ||
|
||
let project = Project::from_template(curr_dir!().join("in")); | ||
let project_root = project.root(); | ||
let cwd = &project_root; | ||
|
||
let features = (0..ACTIVATED_FEATURES_COUNT) | ||
.map(|i| format!("eyes{i:03}")) | ||
.join(","); | ||
snapbox::cmd::Command::cargo_ui() | ||
.arg("add") | ||
.arg_line(format!("your-face --features {features}").as_str()) | ||
.current_dir(cwd) | ||
.assert() | ||
.success() | ||
.stdout_matches_path(curr_dir!().join("stdout.log")) | ||
.stderr_matches_path(curr_dir!().join("stderr.log")); | ||
|
||
assert_ui().subset_matches(curr_dir!().join("out"), &project_root); | ||
} |
8 changes: 8 additions & 0 deletions
8
tests/testsuite/cargo_add/features_too_many_few_activated/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] | ||
your-face = { version = "99999.0.0", features = ["eyes000", "eyes001", "eyes002", "eyes003", "eyes004", "eyes005", "eyes006", "eyes007", "eyes008", "eyes009"] } |
54 changes: 54 additions & 0 deletions
54
tests/testsuite/cargo_add/features_too_many_few_activated/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,54 @@ | ||
Updating `dummy-registry` index | ||
Adding your-face v99999.0.0 to dependencies. | ||
Features: | ||
+ eyes000 | ||
+ eyes001 | ||
+ eyes002 | ||
+ eyes003 | ||
+ eyes004 | ||
+ eyes005 | ||
+ eyes006 | ||
+ eyes007 | ||
+ eyes008 | ||
+ eyes009 | ||
- eyes010 | ||
- eyes011 | ||
- eyes012 | ||
- eyes013 | ||
- eyes014 | ||
- eyes015 | ||
- eyes016 | ||
- eyes017 | ||
- eyes018 | ||
- eyes019 | ||
- eyes020 | ||
- eyes021 | ||
- eyes022 | ||
- eyes023 | ||
- eyes024 | ||
- eyes025 | ||
- eyes026 | ||
- eyes027 | ||
- eyes028 | ||
- eyes029 | ||
- eyes030 | ||
- eyes031 | ||
- eyes032 | ||
- eyes033 | ||
- eyes034 | ||
- eyes035 | ||
- eyes036 | ||
- eyes037 | ||
- eyes038 | ||
- eyes039 | ||
- eyes040 | ||
- eyes041 | ||
- eyes042 | ||
- eyes043 | ||
- eyes044 | ||
- eyes045 | ||
- eyes046 | ||
- eyes047 | ||
- eyes048 | ||
- eyes049 | ||
... 150 more deactivated features |
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