Skip to content

Commit c7685dc

Browse files
authored
test(ocamllsp): ocamldoc markdown conversion (#1093)
Add a more complete test for ocamldoc to markdown conversion
1 parent 88333f9 commit c7685dc

File tree

1 file changed

+98
-7
lines changed

1 file changed

+98
-7
lines changed

ocaml-lsp-server/test/e2e/__tests__/textDocument-signatureHelp.ts

Lines changed: 98 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,58 @@ describe_opt("textDocument/completion", () => {
244244
it("can return documentation for the function being applied", async () => {
245245
openDocument(
246246
outdent`
247-
(** This function has a nice documentation.
248-
249-
It performs division of two integer numbers.
247+
(** This is an example of a docstring that demonstrates various ocamldoc syntax features.
248+
249+
{3 Sections and Labels}
250+
251+
We can create sections using {3 Section title} and labels using {3:label_name Section title with label}
252+
253+
{3 Links and Cross-references}
254+
255+
External links: {{:https://ocaml.org/} OCaml's official website}
256+
257+
{3 Inline Formatting}
258+
259+
{b Bold}, {i Italic}, {e Emphasize}, {^ Superscript}, {_ Subscript}, and [inline code]
260+
261+
{3 Text Alignment}
262+
263+
{C Centered text}
264+
{L Left-aligned text}
265+
{R Right-aligned text}
266+
267+
{3 Lists}
268+
269+
{ol
270+
{- Ordered list item 1}
271+
{- Ordered list item 2}
272+
}
273+
274+
{ul
275+
{- Unordered list item 1}
276+
{- Unordered list item 2}
277+
}
278+
279+
- Unordered list item 1
280+
- Unordered list item 2
281+
282+
{3 Code Blocks}
283+
284+
{[
285+
let square x = x * x
286+
let result = square 3
287+
]}
288+
289+
{3 Verbatim}
290+
291+
{v
292+
This text will be displayed verbatim.
293+
No formatting will be applied.
294+
v}
295+
296+
{3 Module List}
297+
298+
{!modules: Array List String}
250299
251300
@param x dividend
252301
@param divisor
@@ -288,10 +337,52 @@ describe_opt("textDocument/completion", () => {
288337
],
289338
documentation: {
290339
kind: "markdown",
291-
value: outdent`
292-
This function has a nice documentation.
293-
294-
It performs division of two integer numbers.
340+
value: outdent`This is an example of a docstring that demonstrates various ocamldoc syntax features.
341+
342+
#### Sections and Labels
343+
344+
We can create sections using #### Section title
345+
and labels using #### Section title with label
346+
347+
#### Links and Cross-references
348+
349+
External links: [OCaml's official website](https://ocaml.org/)
350+
351+
#### Inline Formatting
352+
353+
**Bold**, *Italic*, *Emphasize*, Superscript, Subscript, and \`inline code\`
354+
355+
#### Text Alignment
356+
357+
Centered text
358+
Left-aligned text
359+
Right-aligned text
360+
361+
#### Lists
362+
363+
1. Ordered list item 1
364+
2. Ordered list item 2
365+
366+
- Unordered list item 1
367+
- Unordered list item 2
368+
369+
- Unordered list item 1
370+
- Unordered list item 2
371+
372+
#### Code Blocks
373+
374+
\`\`\`ocaml
375+
let square x = x * x
376+
let result = square 3
377+
\`\`\`
378+
379+
#### Verbatim
380+
381+
This text will be displayed verbatim.
382+
No formatting will be applied.
383+
384+
#### Module List
385+
295386
* * *
296387
***@param*** \`x\` dividend
297388

0 commit comments

Comments
 (0)