@@ -28,6 +28,48 @@ fn yaml_loader() -> Result<()> {
2828 Ok ( ( ) )
2929}
3030
31+ #[ rstest:: rstest]
32+ #[ case:: standard_lowercase_true( "true" , true ) ]
33+ #[ case:: standard_capitalized_true( "True" , true ) ]
34+ #[ case:: standard_uppercase_true( "TRUE" , true ) ]
35+ #[ case:: yaml_yes_lowercase( "yes" , true ) ]
36+ #[ case:: yaml_yes_capitalized( "Yes" , true ) ]
37+ #[ case:: yaml_yes_uppercase( "YES" , true ) ]
38+ #[ case:: yaml_on_lowercase( "on" , true ) ]
39+ #[ case:: yaml_on_capitalized( "On" , true ) ]
40+ #[ case:: yaml_on_uppercase( "ON" , true ) ]
41+ #[ case:: yaml_y_lowercase( "y" , true ) ]
42+ #[ case:: yaml_y_uppercase( "Y" , true ) ]
43+ #[ case:: standard_lowercase_false( "false" , false ) ]
44+ #[ case:: standard_capitalized_false( "False" , false ) ]
45+ #[ case:: standard_uppercase_false( "FALSE" , false ) ]
46+ #[ case:: yaml_no_lowercase( "no" , false ) ]
47+ #[ case:: yaml_no_capitalized( "No" , false ) ]
48+ #[ case:: yaml_no_uppercase( "NO" , false ) ]
49+ #[ case:: yaml_off_lowercase( "off" , false ) ]
50+ #[ case:: yaml_off_capitalized( "Off" , false ) ]
51+ #[ case:: yaml_off_uppercase( "OFF" , false ) ]
52+ #[ case:: yaml_n_lowercase( "n" , false ) ]
53+ #[ case:: yaml_n_uppercase( "N" , false ) ]
54+ fn test_handle_bool_happy_path ( #[ case] arg : & str , #[ case] expected : bool ) -> Result < ( ) > {
55+ let docs = format ! ( "check: {arg}" ) ;
56+
57+ let mut loader = Loader :: new ( ) ;
58+ match loader. load ( String :: from ( docs) ) ? {
59+ MarkedValue :: Map ( map, ..) => {
60+ assert ! ( map. len( ) == 1 ) ;
61+ let ( .., result) = map. first ( ) . unwrap ( ) ;
62+
63+ if let MarkedValue :: Bool ( result, ..) = * result {
64+ assert_eq ! ( result, expected) ;
65+ }
66+ }
67+ _ => unreachable ! ( "this isn't possible" ) ,
68+ }
69+
70+ Ok ( ( ) )
71+ }
72+
3173#[ test]
3274fn yaml_loader2 ( ) -> Result < ( ) > {
3375 let docs = r###"
0 commit comments