Skip to content

Commit

Permalink
change name of vars method -> command
Browse files Browse the repository at this point in the history
  • Loading branch information
hesampakdaman committed Apr 17, 2024
1 parent 92543aa commit c1dac2b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ fn cli(args: &[String]) -> Result<String, CliErr> {
}

fn parse(args: &[String]) -> Result<ParsedInput, CliErr> {
let method = String::from(&args[1]);
let command_name = String::from(&args[1]);
let n: U512 = args[2].parse().map_err(|_| CliErr::ParseIntErr)?;
Ok(ParsedInput {
number: n,
command_name: method,
command_name,
})
}

Expand All @@ -54,21 +54,21 @@ mod tests {
#[test]
fn happy_cases() {
let cmap = CommandMap::default();
for method in cmap.available_commands().split(", ") {
for command in cmap.available_commands().split(", ") {
assert!(cli(&[
String::from("rustic_factors"),
String::from(method),
String::from(command),
String::from("123")
])
.is_ok());
}
}

#[test]
fn unsupported_method() {
fn unsupported_command() {
match cli(&[
String::from("rustic_factors"),
String::from("unsupported method"),
String::from("unsupported command"),
String::from("123"),
]) {
Err(CliErr::CommandNotFound(_)) => (),
Expand Down

0 comments on commit c1dac2b

Please sign in to comment.