feat: updated bool parsing and added tests

This commit is contained in:
darwincereska
2026-06-08 03:04:17 -04:00
parent af1d05b216
commit 9c087b7baa
8 changed files with 80 additions and 9 deletions
+4
View File
@@ -4,6 +4,7 @@ mod test_parser {
use envkit::parser::parse_number;
#[test]
/// Tests for the `parse_bool` function.
fn test_parse_bool() {
assert_eq!(parse_bool("true"), Ok(true));
assert_eq!(parse_bool("false"), Ok(false));
@@ -11,9 +12,12 @@ mod test_parser {
assert_eq!(parse_bool("0"), Ok(false));
assert_eq!(parse_bool("t"), Ok(true));
assert_eq!(parse_bool("f"), Ok(false));
assert_eq!(parse_bool("yes"), Ok(true));
assert_eq!(parse_bool("no"), Ok(false));
}
#[test]
/// Tests for the `parse_number` function.
fn test_parse_number() {
assert_eq!(parse_number::<i8>("42"), Ok(42_i8));
assert_eq!(parse_number::<i16>("42"), Ok(42_i16));