@@ -916,15 +916,15 @@ mod tests {
916916 #[ test]
917917 fn test_literal_types ( ) {
918918 let mut env = CheckEnv :: new ( ) ;
919- assert_eq ! ( check_expr( & dummy( Expr :: Int ( 42 ) ) , & mut env) . unwrap ( ) , Type :: Int ) ;
920- assert_eq ! ( check_expr( & dummy( Expr :: Float ( 3.14 ) ) , & mut env) . unwrap ( ) , Type :: Float ) ;
921- assert_eq ! ( check_expr( & dummy( Expr :: Bool ( true ) ) , & mut env) . unwrap ( ) , Type :: Bool ) ;
919+ assert_eq ! ( check_expr( & dummy( Expr :: Int ( 42 ) ) , & mut env) . expect ( "TODO: handle error" ) , Type :: Int ) ;
920+ assert_eq ! ( check_expr( & dummy( Expr :: Float ( 3.14 ) ) , & mut env) . expect ( "TODO: handle error" ) , Type :: Float ) ;
921+ assert_eq ! ( check_expr( & dummy( Expr :: Bool ( true ) ) , & mut env) . expect ( "TODO: handle error" ) , Type :: Bool ) ;
922922 assert_eq ! (
923- check_expr( & dummy( Expr :: Ternary ( TernaryValue :: Unknown ) ) , & mut env) . unwrap ( ) ,
923+ check_expr( & dummy( Expr :: Ternary ( TernaryValue :: Unknown ) ) , & mut env) . expect ( "TODO: handle error" ) ,
924924 Type :: Ternary
925925 ) ;
926- assert_eq ! ( check_expr( & dummy( Expr :: String ( "hi" . into( ) ) ) , & mut env) . unwrap ( ) , Type :: String ) ;
927- assert_eq ! ( check_expr( & dummy( Expr :: Unit ) , & mut env) . unwrap ( ) , Type :: Unit ) ;
926+ assert_eq ! ( check_expr( & dummy( Expr :: String ( "hi" . into( ) ) ) , & mut env) . expect ( "TODO: handle error" ) , Type :: String ) ;
927+ assert_eq ! ( check_expr( & dummy( Expr :: Unit ) , & mut env) . expect ( "TODO: handle error" ) , Type :: Unit ) ;
928928 }
929929
930930 #[ test]
@@ -939,7 +939,7 @@ mod tests {
939939 let mut env = CheckEnv :: new ( ) ;
940940 env. bind ( "x" . to_string ( ) , Type :: Int ) ;
941941 let result = check_expr ( & dummy ( Expr :: Var ( Symbol :: intern ( "x" ) ) ) , & mut env) ;
942- assert_eq ! ( result. unwrap ( ) , Type :: Int ) ;
942+ assert_eq ! ( result. expect ( "TODO: handle error" ) , Type :: Int ) ;
943943 }
944944
945945 #[ test]
@@ -953,7 +953,7 @@ mod tests {
953953 ] ,
954954 } ;
955955 let result = check_expr ( & dummy ( Expr :: Bet ( bet) ) , & mut env) ;
956- assert_eq ! ( result. unwrap ( ) , Type :: Int ) ;
956+ assert_eq ! ( result. expect ( "TODO: handle error" ) , Type :: Int ) ;
957957 }
958958
959959 #[ test]
@@ -1003,7 +1003,7 @@ mod tests {
10031003 else_branch : Box :: new ( dummy ( Expr :: Int ( 2 ) ) ) ,
10041004 } ;
10051005 let result = check_expr ( & dummy ( Expr :: If ( if_expr) ) , & mut env) ;
1006- assert_eq ! ( result. unwrap ( ) , Type :: Int ) ;
1006+ assert_eq ! ( result. expect ( "TODO: handle error" ) , Type :: Int ) ;
10071007 }
10081008
10091009 #[ test]
@@ -1012,7 +1012,7 @@ mod tests {
10121012 env. bind ( "d" . to_string ( ) , Type :: Dist ( Box :: new ( Type :: Float ) ) ) ;
10131013 let sample = Expr :: Sample ( Box :: new ( dummy ( Expr :: Var ( Symbol :: intern ( "d" ) ) ) ) ) ;
10141014 let result = check_expr ( & dummy ( sample) , & mut env) ;
1015- assert_eq ! ( result. unwrap ( ) , Type :: Float ) ;
1015+ assert_eq ! ( result. expect ( "TODO: handle error" ) , Type :: Float ) ;
10161016 }
10171017
10181018 #[ test]
@@ -1033,7 +1033,7 @@ mod tests {
10331033 Box :: new ( dummy ( Expr :: Int ( 5 ) ) ) ,
10341034 ) ;
10351035 let result = check_expr ( & dummy ( observe) , & mut env) ;
1036- assert_eq ! ( result. unwrap ( ) , Type :: Unit ) ;
1036+ assert_eq ! ( result. expect ( "TODO: handle error" ) , Type :: Unit ) ;
10371037 }
10381038
10391039 #[ test]
@@ -1057,15 +1057,15 @@ mod tests {
10571057 Box :: new ( dummy ( Expr :: Int ( 1 ) ) ) ,
10581058 Box :: new ( dummy ( Expr :: Int ( 2 ) ) ) ,
10591059 ) ;
1060- assert_eq ! ( check_expr( & dummy( add) , & mut env) . unwrap ( ) , Type :: Int ) ;
1060+ assert_eq ! ( check_expr( & dummy( add) , & mut env) . expect ( "TODO: handle error" ) , Type :: Int ) ;
10611061
10621062 // Float * Int = Float
10631063 let mul = Expr :: BinOp (
10641064 BinOp :: Mul ,
10651065 Box :: new ( dummy ( Expr :: Float ( 1.0 ) ) ) ,
10661066 Box :: new ( dummy ( Expr :: Int ( 2 ) ) ) ,
10671067 ) ;
1068- assert_eq ! ( check_expr( & dummy( mul) , & mut env) . unwrap ( ) , Type :: Float ) ;
1068+ assert_eq ! ( check_expr( & dummy( mul) , & mut env) . expect ( "TODO: handle error" ) , Type :: Float ) ;
10691069 }
10701070
10711071 #[ test]
@@ -1076,7 +1076,7 @@ mod tests {
10761076 Box :: new ( dummy ( Expr :: Int ( 1 ) ) ) ,
10771077 Box :: new ( dummy ( Expr :: Int ( 2 ) ) ) ,
10781078 ) ;
1079- assert_eq ! ( check_expr( & dummy( cmp) , & mut env) . unwrap ( ) , Type :: Bool ) ;
1079+ assert_eq ! ( check_expr( & dummy( cmp) , & mut env) . expect ( "TODO: handle error" ) , Type :: Bool ) ;
10801080 }
10811081
10821082 #[ test]
@@ -1087,14 +1087,14 @@ mod tests {
10871087 Box :: new ( dummy ( Expr :: Bool ( true ) ) ) ,
10881088 Box :: new ( dummy ( Expr :: Ternary ( TernaryValue :: Unknown ) ) ) ,
10891089 ) ;
1090- assert_eq ! ( check_expr( & dummy( and) , & mut env) . unwrap ( ) , Type :: Ternary ) ;
1090+ assert_eq ! ( check_expr( & dummy( and) , & mut env) . expect ( "TODO: handle error" ) , Type :: Ternary ) ;
10911091 }
10921092
10931093 #[ test]
10941094 fn test_unify_basic ( ) {
10951095 let mut env = CheckEnv :: new ( ) ;
10961096 let a = env. fresh_var ( ) ;
1097- env. unify ( & a, & Type :: Int , None ) . unwrap ( ) ;
1097+ env. unify ( & a, & Type :: Int , None ) . expect ( "TODO: handle error" ) ;
10981098 assert_eq ! ( env. resolve( & a) , Type :: Int ) ;
10991099 }
11001100
@@ -1113,7 +1113,7 @@ mod tests {
11131113 dummy( Expr :: Int ( 2 ) ) ,
11141114 dummy( Expr :: Int ( 3 ) ) ,
11151115 ] ) ;
1116- let result = check_expr ( & dummy ( list) , & mut env) . unwrap ( ) ;
1116+ let result = check_expr ( & dummy ( list) , & mut env) . expect ( "TODO: handle error" ) ;
11171117 assert_eq ! ( result, Type :: List ( Box :: new( Type :: Int ) ) ) ;
11181118 }
11191119
@@ -1124,22 +1124,22 @@ mod tests {
11241124 dummy( Expr :: Int ( 1 ) ) ,
11251125 dummy( Expr :: String ( "hi" . into( ) ) ) ,
11261126 ] ) ;
1127- let result = check_expr ( & dummy ( tuple) , & mut env) . unwrap ( ) ;
1127+ let result = check_expr ( & dummy ( tuple) , & mut env) . expect ( "TODO: handle error" ) ;
11281128 assert_eq ! ( result, Type :: Tuple ( vec![ Type :: Int , Type :: String ] ) ) ;
11291129 }
11301130
11311131 #[ test]
11321132 fn test_negation_numeric ( ) {
11331133 let mut env = CheckEnv :: new ( ) ;
11341134 let neg = Expr :: UnOp ( UnOp :: Neg , Box :: new ( dummy ( Expr :: Int ( 5 ) ) ) ) ;
1135- assert_eq ! ( check_expr( & dummy( neg) , & mut env) . unwrap ( ) , Type :: Int ) ;
1135+ assert_eq ! ( check_expr( & dummy( neg) , & mut env) . expect ( "TODO: handle error" ) , Type :: Int ) ;
11361136 }
11371137
11381138 #[ test]
11391139 fn test_not_on_bool ( ) {
11401140 let mut env = CheckEnv :: new ( ) ;
11411141 let not = Expr :: UnOp ( UnOp :: Not , Box :: new ( dummy ( Expr :: Bool ( true ) ) ) ) ;
1142- assert_eq ! ( check_expr( & dummy( not) , & mut env) . unwrap ( ) , Type :: Ternary ) ;
1142+ assert_eq ! ( check_expr( & dummy( not) , & mut env) . expect ( "TODO: handle error" ) , Type :: Ternary ) ;
11431143 }
11441144
11451145 #[ test]
@@ -1149,7 +1149,7 @@ mod tests {
11491149 Box :: new ( dummy ( Expr :: Int ( 100 ) ) ) ,
11501150 Box :: new ( dummy ( Expr :: Float ( 3.14 ) ) ) ,
11511151 ) ;
1152- let result = check_expr ( & dummy ( par) , & mut env) . unwrap ( ) ;
1152+ let result = check_expr ( & dummy ( par) , & mut env) . expect ( "TODO: handle error" ) ;
11531153 assert_eq ! ( result, Type :: List ( Box :: new( Type :: Float ) ) ) ;
11541154 }
11551155}
0 commit comments