Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhibas committed Feb 15, 2024
1 parent c37ad16 commit d16ab11
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,35 @@ mod tests {
assert_eq!(i, " and true");
}

#[test]
fn parse_boolean_test() {
let test_cases = vec![
("true", Ok(("", Atom::Boolean(true)))),
("TRUE", Ok(("", Atom::Boolean(true)))),
("false", Ok(("", Atom::Boolean(false)))),
("FALSE", Ok(("", Atom::Boolean(false)))),
(
"1",
Err(nom::Err::Error(nom::error::Error {
input: "1",
code: nom::error::ErrorKind::Tag,
})),
),
(
"hello",
Err(nom::Err::Error(nom::error::Error {
input: "hello",
code: nom::error::ErrorKind::Tag,
})),
),
];

for (input, expected) in test_cases {
let result = parse_boolean(input);
assert_eq!(result, expected);
}
}

#[test]
fn test_parse_numbers() {
let (_, v) = parse_number("-10").unwrap();
Expand Down

0 comments on commit d16ab11

Please sign in to comment.