Skip to content

Commit

Permalink
Add test for stringutil
Browse files Browse the repository at this point in the history
  • Loading branch information
7h3kk1d committed Dec 13, 2024
1 parent 897ef9a commit d877cfd
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/Test_StringUtil.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
open Alcotest;
open Util;

let tests = (
"StringUtil",
[
test_case(
"Unicode grapheme lengths",
`Quick,
() => {
check(
int,
"Length of upside down question mark",
1,
StringUtil.length("¿"),
);
check(int, "Length of alpha character", 1, StringUtil.length("a"));
check(
int,
"Length of multiple upside down question marks",
3,
StringUtil.length("¿¿¿"),
);
},
),
test_case("regex matches upside down question mark", `Quick, () => {
check(
bool,
"Match upside down question mark",
true,
StringUtil.match(StringUtil.regexp("^¿$"), "¿"),
)
}),
],
);
1 change: 1 addition & 0 deletions test/haz3ltest.re
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ let (suite, _) =
~and_exit=false,
"HazelTests",
[
Test_StringUtil.tests,
("Elaboration", Test_Elaboration.elaboration_tests),
("Statics", Test_Statics.tests),
("Evaluator", Test_Evaluator.tests),
Expand Down

0 comments on commit d877cfd

Please sign in to comment.