forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathounit_analysis_references_tests.ml
More file actions
25 lines (22 loc) · 974 Bytes
/
Copy pathounit_analysis_references_tests.ml
File metadata and controls
25 lines (22 loc) · 974 Bytes
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
open OUnit
let show_reference (module_name, path) =
Printf.sprintf "%s:%s" module_name (String.concat "." path)
let assert_ref_key_eq ~expected ~actual =
assert_equal ~printer:show_reference expected actual
let suites =
__FILE__
>::: [
( "without namespace, external reference is unchanged" >:: fun _ ->
assert_ref_key_eq ~expected:("MyModule2", ["myFunc2"])
~actual:
(Analysis.References.normalizeExternalReferenceKey
~namespace:None ~moduleName:"MyModule2" ~path:["myFunc2"]) );
( "with namespace, hidden module resolves to public namespace path"
>:: fun _ ->
assert_ref_key_eq
~expected:("MyNamespace", ["MyModule2"; "myFunc2"])
~actual:
(Analysis.References.normalizeExternalReferenceKey
~namespace:(Some "MyNamespace")
~moduleName:"MyModule2-MyNamespace" ~path:["myFunc2"]) );
]