fix: address code review findings for public API

This commit is contained in:
2026-10-23 16:38:24 +02:00
committed by owenrees
parent 4f50ff020e
commit 16fcaa3b13
13 changed files with 161 additions and 104 deletions
+24
View File
@@ -170,9 +170,33 @@ let test_clock_in_comment _ctxt =
in
assert_tokens ~ctxt:_ctxt ~input ~is_header:false ~expected
let test_header_unterminated_string_raises _ctxt =
let input = {|Event "oops|} in
let lexbuf = Sedlexing.Utf8.from_string input in
ignore (Lexer.tokenize_header lexbuf);
let exn_opt =
try
ignore (Lexer.tokenize_header lexbuf);
None
with exn -> Some exn
in
assert_bool "Expected exception on unterminated header string"
(Option.is_some exn_opt)
let test_unknown_characters_are_skipped _ctxt =
let input = "1. e4 ?! e5 @ 2. Nf3" in
let expected =
[ NUMBER "1."; MOVE "e4"; MOVE "e5"; NUMBER "2."; MOVE "Nf3"; EOF ]
in
assert_tokens ~ctxt:_ctxt ~input ~is_header:false ~expected
let suite =
"lexer tests"
>::: [
"header_unterminated_string_raises"
>:: test_header_unterminated_string_raises;
"unknown_characters_are_skipped"
>:: test_unknown_characters_are_skipped;
"header_simple" >:: test_header_simple;
"header_escaped_string" >:: test_header_escaped_string;
"numbers_and_moves" >:: test_numbers_and_moves;