Skip to content

Commit

Permalink
Add unit tests for --winter, --debug, --terrain flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamin051000 committed Feb 19, 2025
1 parent 1d34425 commit 60ec9e0
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,33 @@ fn parse_duration(arg: &str) -> Result<std::time::Duration, std::num::ParseIntEr
let seconds = arg.parse()?;
Ok(std::time::Duration::from_secs(seconds))
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_flags() {
// Test that winter/terrain/debug are SetTrue
let cmd = vec![
"arnis",
"--path",
"",
"--bbox",
"",
"--winter",
"--terrain",
"--debug",
];
let args = Args::parse_from(cmd.iter());
assert_eq!(args.winter, true);
assert_eq!(args.debug, true);
assert_eq!(args.terrain, true);

let cmd = vec!["arnis", "--path", "", "--bbox", ""];
let args = Args::parse_from(cmd.iter());
assert_eq!(args.winter, false);
assert_eq!(args.debug, false);
assert_eq!(args.terrain, false);
}
}

0 comments on commit 60ec9e0

Please sign in to comment.