Skip to content

Commit e5e7b23

Browse files
committed
Update tests
1 parent ea03be8 commit e5e7b23

File tree

3 files changed

+23
-16
lines changed

3 files changed

+23
-16
lines changed

test/xref2/canonical_unit.t/run.t

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
Test that @canonical tags work on compilation units when it is placed in the
22
top-comment.
33

4-
The module Test__X is expected to be referenced through Test.X.
4+
The module Test_X is expected to be referenced through Test.X.
55

6-
$ compile test__x.mli test.ml
6+
$ compile test_x.mli test.ml
77

8-
Test__x has a 'canonical' field:
8+
Test_x has a 'canonical' field:
99

10-
$ odoc_print test__x.odocl | jq -c ".canonical"
10+
$ odoc_print test_x.odocl | jq -c ".canonical"
1111
{"Some":{"`Dot":[{"`Root":"Test"},"X"]}}
1212

13-
The alias Test.X should be marked as canonical:
13+
The first two type declarations should have resolved canonical constructors, the third should not
14+
15+
$ odoc_print test.odocl | jq -c ".content.Module.items | .[] | .Type[1] | select(.) | .equation.manifest.Some.Constr"
16+
[{"`Resolved":{"`Type":[{"`Canonical":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test_x"]}},{"`Resolved":{"`Alias":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test_x"]}},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"X"]}}]}}]},"t"]}},[]]
17+
[{"`Resolved":{"`Type":[{"`Canonical":[{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"Test_y"]}},{"`Resolved":{"`Alias":[{"`Canonical":[{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"Test_y"]}},{"`Dot":[{"`Root":"Test"},"Y"]}]},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"Y"]}}]}}]},"t"]}},[]]
18+
[{"`Resolved":{"`Type":[{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"Test_z"]}},"t"]}},[]]
1419

15-
$ odoc_print test.odocl | jq -c ".content.Module.items | .[] | .Module[1].type_.Alias[0] | select(.)"
16-
{"`Resolved":{"`Canonical":[{"`Hidden":{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test__x"]}}},{"`Resolved":{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"X"]}}}]}}
17-
{"`Resolved":{"`Canonical":[{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"Test__y"]}},{"`Resolved":{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"Y"]}}}]}}
18-
{"`Resolved":{"`Hidden":{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"Test__z"]}}}}
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
(** Main module of this test. *)
22

3-
module X = Test__x
3+
module X = Test_x
44

55
(** An other example that is not an unit for comparison.
66
@canonical Test.Y *)
7-
module Test__y = struct
7+
module Test_y = struct
88
type t
99
end
1010

11-
module Y = Test__y
11+
module Y = Test_y
1212

1313
(** An example with the tag inside the sig. *)
14-
module Test__z = struct
14+
module Test_z = struct
1515
(** @canonical Test.Z *)
1616

1717
type t
1818
end
1919

20-
module Z = Test__z
20+
module Z = Test_z
21+
22+
23+
type t = Test_x.t
24+
type u = Test_y.t
25+
type v = Test_z.t
26+

test/xref2/module_list.t/run.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ Everything should resolve:
2727
{"Some":[{"`Word":"Doc"},"`Space",{"`Word":"for"},"`Space",{"`Code_span":"T"},{"`Word":"."}]}
2828
{"`Resolved":{"`SubstAlias":[{"`Module":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"External"]}},"X"]},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Main"]},"Alias"]}}]}}
2929
"None"
30-
{"`Resolved":{"`SubstAlias":[{"`Canonical":[{"`Module":[{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Main"]},"Internal"]}},"C1"]},{"`Resolved":{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Main"]},"C1"]}}}]},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Main"]},"C1"]}}]}}
30+
{"`Resolved":{"`SubstAlias":[{"`Canonical":[{"`Module":[{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Main"]},"Internal"]}},"C1"]},{"`Resolved":{"`Alias":[{"`Canonical":[{"`Module":[{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Main"]},"Internal"]}},"C1"]},{"`Dot":[{"`Root":"Main"},"C1"]}]},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Main"]},"C1"]}}]}}]},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Main"]},"C1"]}}]}}
3131
"None"
32-
{"`Resolved":{"`SubstAlias":[{"`Canonical":[{"`Module":[{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Main"]},"Internal"]}},"C2"]},{"`Resolved":{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Main"]},"C2"]}}}]},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Main"]},"C2"]}}]}}
32+
{"`Resolved":{"`SubstAlias":[{"`Canonical":[{"`Module":[{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Main"]},"Internal"]}},"C2"]},{"`Resolved":{"`Alias":[{"`Canonical":[{"`Module":[{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Main"]},"Internal"]}},"C2"]},{"`Dot":[{"`Root":"Main"},"C2"]}]},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Main"]},"C2"]}}]}}]},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Main"]},"C2"]}}]}}
3333
"None"
3434
{"`Resolved":{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Main"]},"Inline_include"]}}}
3535
"None"

0 commit comments

Comments
 (0)