Skip to content

Commit 7838de3

Browse files
committed
Add a module type alias reference cram test
1 parent cbed3df commit 7838de3

File tree

2 files changed

+123
-0
lines changed

2 files changed

+123
-0
lines changed

test/xref2/module_type_alias.t/run.t

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
Test module type aliases
2+
3+
In the following module:
4+
5+
$ cat test.mli
6+
module type A = sig
7+
type t
8+
val v : t
9+
end
10+
11+
module type B = A
12+
13+
(** {!B} {!B.t} *)
14+
15+
both the references in the comment ought to contain AliasModuleType constructors
16+
as they are both referencing items that won't be expanded.
17+
18+
$ ocamlc -c -bin-annot test.mli
19+
$ odoc compile test.cmti
20+
$ odoc link test.odoc
21+
$ odoc html-generate -o html test.odocl
22+
$ odoc_print test.odocl | jq ".content.Module.items[2]"
23+
{
24+
"Comment": {
25+
"`Docs": [
26+
{
27+
"`Paragraph": [
28+
{
29+
"`Reference": [
30+
{
31+
"`Resolved": {
32+
"`AliasModuleType": [
33+
{
34+
"`Identifier": {
35+
"`ModuleType": [
36+
{
37+
"`Root": [
38+
"None",
39+
"Test"
40+
]
41+
},
42+
"A"
43+
]
44+
}
45+
},
46+
{
47+
"`Identifier": {
48+
"`ModuleType": [
49+
{
50+
"`Root": [
51+
"None",
52+
"Test"
53+
]
54+
},
55+
"B"
56+
]
57+
}
58+
}
59+
]
60+
}
61+
},
62+
[]
63+
]
64+
},
65+
"`Space",
66+
{
67+
"`Reference": [
68+
{
69+
"`Resolved": {
70+
"`Type": [
71+
{
72+
"`AliasModuleType": [
73+
{
74+
"`Identifier": {
75+
"`ModuleType": [
76+
{
77+
"`Root": [
78+
"None",
79+
"Test"
80+
]
81+
},
82+
"A"
83+
]
84+
}
85+
},
86+
{
87+
"`Identifier": {
88+
"`ModuleType": [
89+
{
90+
"`Root": [
91+
"None",
92+
"Test"
93+
]
94+
},
95+
"B"
96+
]
97+
}
98+
}
99+
]
100+
},
101+
"t"
102+
]
103+
}
104+
},
105+
[]
106+
]
107+
}
108+
]
109+
}
110+
]
111+
}
112+
}
113+
114+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module type A = sig
2+
type t
3+
val v : t
4+
end
5+
6+
module type B = A
7+
8+
(** {!B} {!B.t} *)
9+

0 commit comments

Comments
 (0)