Skip to content

Commit 9f88aff

Browse files
Julowjonludlam
authored andcommitted
Test comments in classes
1 parent d88e57a commit 9f88aff

File tree

14 files changed

+214
-6
lines changed

14 files changed

+214
-6
lines changed

test/generators/cases/class.mli

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,26 @@ object
2424
end
2525

2626
class ['a] polymorphic' : ['a] polymorphic
27+
28+
(* Comments *)
29+
30+
class x : object end
31+
32+
class ['a] c :
33+
object
34+
inherit x
35+
(** Inherit. *)
36+
37+
constraint 'a = int
38+
(** Constraint. *)
39+
40+
(**/**)
41+
42+
method foo : int
43+
44+
(**/**)
45+
46+
(** Floating comment. *)
47+
48+
method bar : int
49+
end
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head><title>c (Class.c)</title><link rel="stylesheet" href="odoc.css"/>
4+
<meta charset="utf-8"/><meta name="generator" content="odoc %%VERSION%%"/>
5+
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
6+
<script src="highlight.pack.js"></script>
7+
<script>hljs.initHighlightingOnLoad();</script>
8+
</head>
9+
<body class="odoc">
10+
<nav class="odoc-nav"><a href="Class.html">Up</a>
11+
<a href="Class.html">Class</a> &#x00BB; c
12+
</nav>
13+
<header class="odoc-preamble">
14+
<h1>Class <code><span>Class.c</span></code></h1>
15+
</header>
16+
<div class="odoc-content">
17+
<div class="odoc-spec">
18+
<div class="spec inherit">
19+
<code>
20+
<span><span class="keyword">inherit</span>
21+
<a href="Class-class-x.html">x</a>
22+
</span>
23+
</code>
24+
</div><div class="spec-doc"><p>Inherit.</p></div>
25+
</div>
26+
<div class="odoc-spec">
27+
<div class="spec">
28+
<code>
29+
<span> <span class="keyword">constraint</span>
30+
<span class="type-var">'a</span> = int
31+
</span>
32+
</code>
33+
</div><div class="spec-doc"><p>Constraint.</p></div>
34+
</div><p>Floating comment.</p>
35+
<div class="odoc-spec">
36+
<div class="spec method anchored" id="method-bar">
37+
<a href="#method-bar" class="anchor"></a>
38+
<code><span><span class="keyword">method</span> bar : int</span></code>
39+
</div>
40+
</div>
41+
</div>
42+
</body>
43+
</html>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head><title>x (Class.x)</title><link rel="stylesheet" href="odoc.css"/>
4+
<meta charset="utf-8"/><meta name="generator" content="odoc %%VERSION%%"/>
5+
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
6+
<script src="highlight.pack.js"></script>
7+
<script>hljs.initHighlightingOnLoad();</script>
8+
</head>
9+
<body class="odoc">
10+
<nav class="odoc-nav"><a href="Class.html">Up</a>
11+
<a href="Class.html">Class</a> &#x00BB; x
12+
</nav>
13+
<header class="odoc-preamble">
14+
<h1>Class <code><span>Class.x</span></code></h1>
15+
</header><div class="odoc-content"></div>
16+
</body>
17+
</html>

test/generators/html/Class.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,28 @@ <h1>Module <code><span>Class</span></code></h1>
126126
</code>
127127
</div>
128128
</div>
129+
<div class="odoc-spec">
130+
<div class="spec class anchored" id="class-x">
131+
<a href="#class-x" class="anchor"></a>
132+
<code><span><span class="keyword">class</span> </span>
133+
<span><a href="Class-class-x.html">x</a></span>
134+
<span> : <span class="keyword">object</span> ...
135+
<span class="keyword">end</span>
136+
</span>
137+
</code>
138+
</div>
139+
</div>
140+
<div class="odoc-spec">
141+
<div class="spec class anchored" id="class-c">
142+
<a href="#class-c" class="anchor"></a>
143+
<code><span><span class="keyword">class</span> 'a </span>
144+
<span><a href="Class-class-c.html">c</a></span>
145+
<span> : <span class="keyword">object</span> ...
146+
<span class="keyword">end</span>
147+
</span>
148+
</code>
149+
</div>
150+
</div>
129151
</div>
130152
</body>
131153
</html>

test/generators/html/class.targets

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ Class-class-type-empty_virtual.html
88
Class-class-empty_virtual'.html
99
Class-class-type-polymorphic.html
1010
Class-class-polymorphic'.html
11+
Class-class-x.html
12+
Class-class-c.html

test/generators/latex/Class.c.tex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
\section{Class \ocamlinlinecode{Class.\allowbreak{}c}}\label{module-Class-class-c}%
2+
\ocamlcodefragment{\ocamltag{keyword}{inherit} \hyperref[module-Class-class-x]{\ocamlinlinecode{x}}}\begin{ocamlindent}Inherit.\end{ocamlindent}%
3+
\medbreak
4+
\ocamlcodefragment{ \ocamltag{keyword}{constraint} \ocamltag{type-var}{'a} = int}\begin{ocamlindent}Constraint.\end{ocamlindent}%
5+
\medbreak
6+
Floating comment.
7+
8+
\label{module-Class-class-c-method-bar}\ocamlcodefragment{\ocamltag{keyword}{method} bar : int}\\
9+
10+

test/generators/latex/Class.tex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ \section{Module \ocamlinlinecode{Class}}\label{module-Class}%
1313
\label{module-Class-class-type-polymorphic}\ocamlcodefragment{\ocamltag{keyword}{class} \ocamltag{keyword}{type} 'a \hyperref[module-Class-class-type-polymorphic]{\ocamlinlinecode{polymorphic}}}\ocamlcodefragment{ = \ocamltag{keyword}{object}}\begin{ocamlindent}\end{ocamlindent}%
1414
\ocamlcodefragment{\ocamltag{keyword}{end}}\\
1515
\label{module-Class-class-polymorphic'}\ocamlcodefragment{\ocamltag{keyword}{class} 'a \hyperref[module-Class-class-polymorphic']{\ocamlinlinecode{polymorphic'}}}\ocamlcodefragment{ : \ocamltag{type-var}{'a} \hyperref[module-Class-class-type-polymorphic]{\ocamlinlinecode{polymorphic}}}\\
16+
\label{module-Class-class-x}\ocamlcodefragment{\ocamltag{keyword}{class} \hyperref[module-Class-class-x]{\ocamlinlinecode{x}}}\ocamlcodefragment{ : \ocamltag{keyword}{object} .\allowbreak{}.\allowbreak{}.\allowbreak{} \ocamltag{keyword}{end}}\\
17+
\label{module-Class-class-c}\ocamlcodefragment{\ocamltag{keyword}{class} 'a \hyperref[module-Class-class-c]{\ocamlinlinecode{c}}}\ocamlcodefragment{ : \ocamltag{keyword}{object} .\allowbreak{}.\allowbreak{}.\allowbreak{} \ocamltag{keyword}{end}}\\
1618

1719
\input{Class.mutually'.tex}
1820
\input{Class.recursive'.tex}
1921
\input{Class.empty_virtual'.tex}
2022
\input{Class.polymorphic'.tex}
23+
\input{Class.x.tex}
24+
\input{Class.c.tex}

test/generators/latex/Class.x.tex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
\section{Class \ocamlinlinecode{Class.\allowbreak{}x}}\label{module-Class-class-x}%
2+
3+

test/generators/latex/class.targets

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ Class.mutually'.tex
33
Class.recursive'.tex
44
Class.empty_virtual'.tex
55
Class.polymorphic'.tex
6+
Class.x.tex
7+
Class.c.tex

test/generators/link.dune.inc

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,9 @@
10291029
Class-class-type-empty_virtual.html.gen
10301030
Class-class-empty_virtual'.html.gen
10311031
Class-class-type-polymorphic.html.gen
1032-
Class-class-polymorphic'.html.gen)
1032+
Class-class-polymorphic'.html.gen
1033+
Class-class-x.html.gen
1034+
Class-class-c.html.gen)
10331035
(action
10341036
(run
10351037
odoc
@@ -1084,7 +1086,15 @@
10841086
(rule
10851087
(alias runtest)
10861088
(action
1087-
(diff Class-class-polymorphic'.html Class-class-polymorphic'.html.gen))))
1089+
(diff Class-class-polymorphic'.html Class-class-polymorphic'.html.gen)))
1090+
(rule
1091+
(alias runtest)
1092+
(action
1093+
(diff Class-class-x.html Class-class-x.html.gen)))
1094+
(rule
1095+
(alias runtest)
1096+
(action
1097+
(diff Class-class-c.html Class-class-c.html.gen))))
10881098

10891099
(subdir
10901100
html
@@ -1106,7 +1116,9 @@
11061116
Class.mutually'.tex.gen
11071117
Class.recursive'.tex.gen
11081118
Class.empty_virtual'.tex.gen
1109-
Class.polymorphic'.tex.gen)
1119+
Class.polymorphic'.tex.gen
1120+
Class.x.tex.gen
1121+
Class.c.tex.gen)
11101122
(action
11111123
(run odoc latex-generate -o . --extra-suffix gen %{dep:../class.odocl})))
11121124
(rule
@@ -1128,7 +1140,15 @@
11281140
(rule
11291141
(alias runtest)
11301142
(action
1131-
(diff Class.polymorphic'.tex Class.polymorphic'.tex.gen))))
1143+
(diff Class.polymorphic'.tex Class.polymorphic'.tex.gen)))
1144+
(rule
1145+
(alias runtest)
1146+
(action
1147+
(diff Class.x.tex Class.x.tex.gen)))
1148+
(rule
1149+
(alias runtest)
1150+
(action
1151+
(diff Class.c.tex Class.c.tex.gen))))
11321152

11331153
(subdir
11341154
latex
@@ -1150,7 +1170,9 @@
11501170
Class.mutually'.3o.gen
11511171
Class.recursive'.3o.gen
11521172
Class.empty_virtual'.3o.gen
1153-
Class.polymorphic'.3o.gen)
1173+
Class.polymorphic'.3o.gen
1174+
Class.x.3o.gen
1175+
Class.c.3o.gen)
11541176
(action
11551177
(run odoc man-generate -o . --extra-suffix gen %{dep:../class.odocl})))
11561178
(rule
@@ -1172,7 +1194,15 @@
11721194
(rule
11731195
(alias runtest)
11741196
(action
1175-
(diff Class.polymorphic'.3o Class.polymorphic'.3o.gen))))
1197+
(diff Class.polymorphic'.3o Class.polymorphic'.3o.gen)))
1198+
(rule
1199+
(alias runtest)
1200+
(action
1201+
(diff Class.x.3o Class.x.3o.gen)))
1202+
(rule
1203+
(alias runtest)
1204+
(action
1205+
(diff Class.c.3o Class.c.3o.gen))))
11761206

11771207
(subdir
11781208
man

0 commit comments

Comments
 (0)