failwith test
This commit is contained in:
parent
288b7e9149
commit
e0e5228254
@ -10,3 +10,21 @@ function main (const p : param; const s : unit) : list(operation) * unit is
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
with ((nil : list(operation)), s)
|
with ((nil : list(operation)), s)
|
||||||
|
|
||||||
|
function foobar (const i : int) : unit is
|
||||||
|
var p : param := Zero (42n) ;
|
||||||
|
block {
|
||||||
|
if i > 0 then block {
|
||||||
|
i := i + 1 ;
|
||||||
|
if i > 10 then block {
|
||||||
|
i := 20 ;
|
||||||
|
failwith ("who knows") ;
|
||||||
|
i := 30 ;
|
||||||
|
} else skip
|
||||||
|
} else block {
|
||||||
|
case p of
|
||||||
|
| Zero (n) -> failwith ("wooo")
|
||||||
|
| Pos (n) -> skip
|
||||||
|
end
|
||||||
|
}
|
||||||
|
} with unit
|
||||||
|
@ -651,6 +651,11 @@ let failwith_ligo () : unit result =
|
|||||||
let%bind _ = should_fail (e_pair (e_constructor "Zero" (e_nat 1)) (e_unit ())) in
|
let%bind _ = should_fail (e_pair (e_constructor "Zero" (e_nat 1)) (e_unit ())) in
|
||||||
let%bind _ = should_work (e_pair (e_constructor "Pos" (e_nat 1)) (e_unit ())) in
|
let%bind _ = should_work (e_pair (e_constructor "Pos" (e_nat 1)) (e_unit ())) in
|
||||||
let%bind _ = should_fail (e_pair (e_constructor "Pos" (e_nat 0)) (e_unit ())) in
|
let%bind _ = should_fail (e_pair (e_constructor "Pos" (e_nat 0)) (e_unit ())) in
|
||||||
|
let should_fail input = expect_fail program "foobar" (e_int input) in
|
||||||
|
let should_work input = expect_eq program "foobar" (e_int input) (e_unit ()) in
|
||||||
|
let%bind () = should_fail @@ 10 in
|
||||||
|
let%bind () = should_fail @@ -10 in
|
||||||
|
let%bind () = should_work @@ 5 in
|
||||||
ok ()
|
ok ()
|
||||||
|
|
||||||
let failwith_mligo () : unit result =
|
let failwith_mligo () : unit result =
|
||||||
|
Loading…
Reference in New Issue
Block a user