Skip to content

Commit

Permalink
Added crate-level RTS
Browse files Browse the repository at this point in the history
  • Loading branch information
hundsdor committed Jul 22, 2024
1 parent 6035bdc commit b3edc82
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
27 changes: 27 additions & 0 deletions src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,16 @@ mod test {
// "--workspace"
]
);
assert_eq!(
cargo_argv(build_dir, None, Phase::Basic, &options)[1..],
[
"rustyrts",
"basic",
"-Z",
"no-index-update",
// "--workspace",
]
);
assert_eq!(
cargo_argv(build_dir, None, Phase::Dynamic, &options)[1..],
[
Expand Down Expand Up @@ -308,6 +318,10 @@ mod test {
// build_manifest_path.as_str(),
]
);
assert_eq!(
cargo_argv(build_dir, Some(&[&package]), Phase::Basic, &options)[1..],
["rustyrts", "basic", "-Z", "no-index-update",]
);
assert_eq!(
cargo_argv(build_dir, Some(&[&package]), Phase::Dynamic, &options)[1..],
["rustyrts", "dynamic", "-Z", "no-index-update",]
Expand Down Expand Up @@ -372,6 +386,19 @@ mod test {
"--test-threads=1"
]
);
assert_eq!(
cargo_argv(build_dir, None, Phase::Basic, &options)[1..],
[
"rustyrts",
"basic",
"-Z",
"no-index-update",
"--verbose",
// "--workspace",
"--",
"--test-threads=1"
]
);
assert_eq!(
cargo_argv(build_dir, None, Phase::Dynamic, &options)[1..],
[
Expand Down
1 change: 1 addition & 0 deletions src/lab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ fn test_scenario(
let test_phase = match options.test_tool {
TestTool::Cargo => Phase::Test,
TestTool::Nextest => panic!("Nextest is not supported"),
TestTool::Basic => Phase::Basic,
TestTool::Dynamic => Phase::Dynamic,
TestTool::Static => Phase::Static,
};
Expand Down
3 changes: 3 additions & 0 deletions src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ pub enum TestTool {
/// Use `cargo nextest`.
Nextest,

// Use 'cargo rustyrts basic'
Basic,

// Use 'cargo rustyrts dynamic'
Dynamic,

Expand Down
12 changes: 11 additions & 1 deletion src/outcome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub enum Phase {
Check,
Build,
Test,
Basic,
Dynamic,
Static,
BuildDynamic,
Expand All @@ -48,13 +49,22 @@ impl Phase {
Phase::BuildDynamic => vec!["build"],

Phase::Test => vec!["test"],
Phase::Basic => vec!["rustyrts", "basic"],
Phase::Dynamic => vec!["rustyrts", "dynamic"],
Phase::Static => vec!["rustyrts", "static"],
}
}

pub fn is_test_phase(&self) -> bool {
return self == &Phase::Test || self == &Phase::Dynamic || self == &Phase::Static;
match self {
Phase::Check => false,
Phase::Build => false,
Phase::Test => true,
Phase::Basic => true,
Phase::Dynamic => true,
Phase::Static => true,
Phase::BuildDynamic => false,
}
}
}

Expand Down

0 comments on commit b3edc82

Please sign in to comment.