Skip to content

Commit

Permalink
refactor(derive): Clarify tests
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Mar 25, 2024
1 parent 58469d1 commit be73195
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/derive/non_literal_attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,19 @@ fn test_bool() {
assert_eq!(result.unwrap_err().kind(), ErrorKind::NoEquals);
}

fn parse_hex(input: &str) -> Result<u64, ParseIntError> {
u64::from_str_radix(input, 16)
}

#[derive(Parser, PartialEq, Debug)]
struct HexOpt {
#[arg(short, value_parser = parse_hex)]
number: u64,
}

#[test]
#[cfg(feature = "error-context")]
fn test_parse_hex_function_path() {
#[derive(Parser, PartialEq, Debug)]
struct HexOpt {
#[arg(short, value_parser = parse_hex)]
number: u64,
}

fn parse_hex(input: &str) -> Result<u64, ParseIntError> {
u64::from_str_radix(input, 16)
}

assert_eq!(
HexOpt { number: 5 },
HexOpt::try_parse_from(["test", "-n", "5"]).unwrap()
Expand Down

0 comments on commit be73195

Please sign in to comment.