Skip to content

Commit 2a090ed

Browse files
cknittclaude
andcommitted
Test OCaml rewatch's module names against Rust's new cases
Rust now capitalizes only an ASCII first letter (#8797), as this port did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
1 parent 5b20a74 commit 2a090ed

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎tests/rewatch_ounit_tests/unit_tests.ml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,20 @@ let test_executable () = Unix.realpath Sys.executable_name
116116
let process_job args =
117117
{Process.program = test_executable (); args; cwd = Sys.getcwd ()}
118118

119+
(* Like the compiler and Rust rewatch: the whole stem is the module name, and
120+
only an ASCII first letter is capitalized. *)
121+
let module_name_tests _context =
122+
[
123+
("src/foo.res", "Foo");
124+
("src/Foo.resi", "Foo");
125+
("src/foo.test.res", "Foo.test");
126+
("src/_app.res", "_app");
127+
("src/\195\169clair.res", "\195\169clair");
128+
("src/\195\159eta.res", "\195\159eta");
129+
]
130+
|> List.iter (fun (path, expected) ->
131+
assert_equal ~printer:Fun.id expected (Source.module_name path))
132+
119133
let string_util_tests _context =
120134
[
121135
("", "", true);
@@ -968,6 +982,7 @@ let tests =
968982
"unit_tests"
969983
>::: [
970984
"string_util" >:: string_util_tests;
985+
"module_name" >:: module_name_tests;
971986
"process_parallel" >:: process_parallel_tests;
972987
"process_cancellation" >:: process_cancellation_tests;
973988
"process_dependency_graph" >:: process_dependency_graph_tests;

0 commit comments

Comments
 (0)