Skip to content

Commit 2d22148

Browse files
committed
test(cli): add tests for argument parsing
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
1 parent d173570 commit 2d22148

File tree

25 files changed

+447
-38
lines changed

25 files changed

+447
-38
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ syn = { version = "2", features = ["full"] }
3030
quote = { version = "1" }
3131
rstest = "0.26"
3232
tempfile = "3"
33+
pretty_assertions = "1"
3334

3435
[profile.release]
3536
lto = true

alioth-cli/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,9 @@ serde-aco.workspace = true
2020
[[bin]]
2121
path = "src/main.rs"
2222
name = "alioth"
23+
24+
[dev-dependencies]
25+
assert_matches.workspace = true
26+
ctor.workspace = true
27+
rstest.workspace = true
28+
pretty_assertions.workspace = true

alioth-cli/src/boot.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub enum Error {
6464
WaitVm { source: alioth::vm::Error },
6565
}
6666

67-
#[derive(Args, Debug, Clone)]
67+
#[derive(Args, Debug, Clone, Default)]
6868
#[command(arg_required_else_help = true, alias("run"))]
6969
pub struct BootArgs {
7070
#[arg(long, help(
@@ -362,3 +362,7 @@ pub fn boot(mut args: BootArgs) -> Result<(), Error> {
362362
vm.wait().context(error::WaitVm)?;
363363
Ok(())
364364
}
365+
366+
#[cfg(test)]
367+
#[path = "boot_test.rs"]
368+
mod tests;

0 commit comments

Comments
 (0)