mirror of
https://github.com/darwincereska/envkit.git
synced 2026-06-11 10:23:23 -05:00
feat: updated bool parsing and added tests
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user