Skip to content

Commit 7027d1b

Browse files
authored
test: test all combinations (#3)
Signed-off-by: tison <wander4096@gmail.com>
1 parent 1bee34f commit 7027d1b

File tree

3 files changed

+21
-22
lines changed

3 files changed

+21
-22
lines changed

Cargo.lock

Lines changed: 8 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

xtask/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ release = false
2828

2929
[dependencies]
3030
clap = { version = "4.5.23", features = ["derive"] }
31-
which = { version = "7.0.1" }
31+
which = { version = "8.0.0" }
3232

3333
[lints]
3434
workspace = true

xtask/src/main.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,17 @@ struct CommandTest {
6363

6464
impl CommandTest {
6565
fn run(self) {
66-
run_command(make_test_cmd(self.no_capture, true, &[]));
67-
run_command(make_test_cmd(self.no_capture, true, &["std", "derive"]));
66+
let features = ["std", "derive", "traverse-trivial", "traverse-std"];
67+
68+
for i in 0..(1 << features.len()) {
69+
let mut selected_features = vec![];
70+
for (k, feature) in features.iter().enumerate() {
71+
if (i & (1 << k)) != 0 {
72+
selected_features.push(*feature);
73+
}
74+
}
75+
run_command(make_test_cmd(self.no_capture, &selected_features));
76+
}
6877
}
6978
}
7079

@@ -129,12 +138,9 @@ fn make_build_cmd(locked: bool) -> StdCommand {
129138
cmd
130139
}
131140

132-
fn make_test_cmd(no_capture: bool, default_features: bool, features: &[&str]) -> StdCommand {
141+
fn make_test_cmd(no_capture: bool, features: &[&str]) -> StdCommand {
133142
let mut cmd = find_command("cargo");
134143
cmd.args(["test", "--workspace"]);
135-
if !default_features {
136-
cmd.arg("--no-default-features");
137-
}
138144
if !features.is_empty() {
139145
cmd.args(["--features", features.join(",").as_str()]);
140146
}

0 commit comments

Comments
 (0)