package commons
Yet another set of common utilities
Install
Dune Dependency
Authors
Maintainers
Sources
commons_1.8.0.tar.gz
md5=00142d2d5f299c86ee44f19820bf9874
sha512=d25a57c434514ecb9adc5a129eeec9feca1cea2d1383e3bde74b52a05da174a09e0f46e7407f7b86ecdf1bf6faf7e0a66ef744d6fb389cb5f8398bc32e349555
doc/src/commons.tests/Unit_SPcre.ml.html
Source file Unit_SPcre.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
(* Unit tests for SPcre *) let test_match_limit_ok () = let rex = SPcre.regexp "(a+)+$" in match SPcre.pmatch ~rex "aaaaaaaaaaaaaaaaa!" with | Ok _ -> () | Error Pcre.MatchLimit -> Alcotest.fail "should not have failed with error MatchLimit" | Error _ -> Alcotest.fail "unexpected error" let test_match_limit_fail () = let rex = SPcre.regexp "(a+)+$" in match SPcre.pmatch ~rex "aaaaaaaaaaaaaaaaaa!" with | Ok _ -> Alcotest.fail "should have failed with error MatchLimit" | Error Pcre.MatchLimit -> () | Error _ -> Alcotest.fail "unexpected error" let test_register_exception_printer () = (* This is a little dirty since we can't undo it. *) SPcre.register_exception_printer (); let msg = try ignore (SPcre.regexp "???"); Alcotest.fail "should have failed to compile the regexp" with | e -> Printexc.to_string e in Alcotest.(check string) "equal" "Pcre.Error(Pcre.BadPattern(\"nothing to repeat\", pos=0))" msg let tests = Testutil.pack_tests "pcre settings" [ ("match limit ok", test_match_limit_ok); ("match limit fail", test_match_limit_fail); ("exception printer", test_register_exception_printer); ]
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>