Skip to content

Commit

Permalink
Add deferral elaboration test
Browse files Browse the repository at this point in the history
  • Loading branch information
7h3kk1d committed Oct 1, 2024
1 parent 8fbfe3b commit 854edc8
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/Test_Elaboration.re
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,33 @@ let let_fun = () =>
dhexp_of_uexp(u9),
);

let deferral = () =>
alco_check(
"string_sub(\"hello\", 1, _)",
dhexp_of_uexp(
DeferredAp(
Var("string_sub") |> Exp.fresh,
[
String("hello") |> Exp.fresh,
Int(1) |> Exp.fresh,
Deferral(InAp) |> Exp.fresh,
],
)
|> Exp.fresh,
),
dhexp_of_uexp(
DeferredAp(
Var("string_sub") |> Exp.fresh,
[
String("hello") |> Exp.fresh,
Int(1) |> Exp.fresh,
Deferral(InAp) |> Exp.fresh,
],
)
|> Exp.fresh,
),
);

let elaboration_tests = [
test_case("Single integer", `Quick, single_integer),
test_case("Empty hole", `Quick, empty_hole),
Expand All @@ -188,4 +215,9 @@ let elaboration_tests = [
test_case("Application of function on free variable", `Quick, ap_fun),
test_case("Inconsistent case statement", `Quick, inconsistent_case),
test_case("Let expression for a function", `Quick, let_fun),
test_case(
"Function application with a deferred argument",
`Quick,
deferral,
),
];

0 comments on commit 854edc8

Please sign in to comment.