Skip to content

Commit 47e539c

Browse files
Julowjonludlam
authored andcommitted
Add a test for duplicated preamble with inline includes
1 parent f3a7ca9 commit 47e539c

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include Foo
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
(** Preamble for Foo. *)
2+
3+
(** Preamble for O. *)
4+
module O : sig
5+
val x : int
6+
end
7+
8+
include module type of O (** @inline *)
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
$ compile foo.mli bar.ml
2+
$ odoc html-generate -o html --indent foo.odocl
3+
$ odoc html-generate -o html --indent bar.odocl
4+
5+
Foo contains "Preamble for O" twice: once for the module O definition, once
6+
coming from the inline include.
7+
8+
$ cat html/test/Foo/index.html
9+
<!DOCTYPE html>
10+
<html xmlns="http://www.w3.org/1999/xhtml">
11+
<head><title>Foo (test.Foo)</title><meta charset="utf-8"/>
12+
<link rel="stylesheet" href="../../odoc.css"/>
13+
<meta name="generator" content="odoc %%VERSION%%"/>
14+
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
15+
<script src="../../highlight.pack.js"></script>
16+
<script>hljs.initHighlightingOnLoad();</script>
17+
</head>
18+
<body class="odoc">
19+
<nav class="odoc-nav"><a href="../index.html">Up</a> –
20+
<a href="../index.html">test</a> &#x00BB; Foo
21+
</nav>
22+
<header class="odoc-preamble"><h1>Module <code><span>Foo</span></code></h1>
23+
<p>Preamble for Foo.</p>
24+
</header>
25+
<div class="odoc-content">
26+
<div class="odoc-spec">
27+
<div class="spec module anchored" id="module-O">
28+
<a href="#module-O" class="anchor"></a>
29+
<code>
30+
<span><span class="keyword">module</span> <a href="O/index.html">O</a>
31+
</span>
32+
<span> : <span class="keyword">sig</span> ...
33+
<span class="keyword">end</span>
34+
</span>
35+
</code>
36+
</div><div class="spec-doc"><p>Preamble for O.</p></div>
37+
</div><p>Preamble for O.</p>
38+
<div class="odoc-spec">
39+
<div class="spec value anchored" id="val-x">
40+
<a href="#val-x" class="anchor"></a>
41+
<code><span><span class="keyword">val</span> x : int</span></code>
42+
</div>
43+
</div>
44+
</div>
45+
</body>
46+
</html>
47+
48+
Bar includes Foo and should also contain "Preamble for O" twice.
49+
TODO: It contains "Preamble for O" 3 times.
50+
TODO: It doesn't contain "Preamble for Foo".
51+
52+
$ cat html/test/Bar/index.html
53+
<!DOCTYPE html>
54+
<html xmlns="http://www.w3.org/1999/xhtml">
55+
<head><title>Bar (test.Bar)</title><meta charset="utf-8"/>
56+
<link rel="stylesheet" href="../../odoc.css"/>
57+
<meta name="generator" content="odoc %%VERSION%%"/>
58+
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
59+
<script src="../../highlight.pack.js"></script>
60+
<script>hljs.initHighlightingOnLoad();</script>
61+
</head>
62+
<body class="odoc">
63+
<nav class="odoc-nav"><a href="../index.html">Up</a> –
64+
<a href="../index.html">test</a> &#x00BB; Bar
65+
</nav>
66+
<header class="odoc-preamble"><h1>Module <code><span>Bar</span></code></h1>
67+
</header>
68+
<div class="odoc-content">
69+
<div class="odoc-include">
70+
<details open="open">
71+
<summary class="spec include">
72+
<code>
73+
<span><span class="keyword">include</span>
74+
<span class="keyword">module</span> <span class="keyword">type</span>
75+
<span class="keyword">of</span> <span class="keyword">struct</span>
76+
<span class="keyword">include</span>
77+
<a href="../Foo/index.html">Foo</a> <span class="keyword">end</span>
78+
</span>
79+
</code>
80+
</summary>
81+
<div class="odoc-spec">
82+
<div class="spec module anchored" id="module-O">
83+
<a href="#module-O" class="anchor"></a>
84+
<code><span><span class="keyword">module</span> O</span>
85+
<span> = <a href="../Foo/O/index.html">Foo.O</a></span>
86+
</code>
87+
</div><div class="spec-doc"><p>Preamble for O.</p></div>
88+
</div><p>Preamble for O.</p><p>Preamble for O.</p>
89+
<div class="odoc-spec">
90+
<div class="spec value anchored" id="val-x">
91+
<a href="#val-x" class="anchor"></a>
92+
<code><span><span class="keyword">val</span> x : int</span></code>
93+
</div>
94+
</div>
95+
</details>
96+
</div>
97+
</div>
98+
</body>
99+
</html>

0 commit comments

Comments
 (0)