File: run.t

package info (click to toggle)
ocaml-odoc 2.1.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,744 kB
  • sloc: ml: 37,049; makefile: 124; sh: 79
file content (37 lines) | stat: -rw-r--r-- 1,277 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Test the 'initially opened module' feature.

This causes module to be opened and in the environment at all times. Module, Module Type and
Type paths that can be simplified will be. By default 'Stdlib' is opened initially, therefore
paths that would otherwise be rendered as 'Stdlib.X.Y' will be rendered as 'X.Y'.

We test the feature by creating 2 modules, one referencing the other, and odoc compiling twice,
once with the module opened and once without.

  $ cat to_open.mli
  type t

  $ cat other.mli
  type t = To_open.t
  

  $ ocamlc -c -bin-annot to_open.mli
  $ ocamlc -c -bin-annot other.mli
  $ odoc compile --package x to_open.cmti


Run 'normally', without opening the module 'To_open':

  $ odoc compile --package x -I . other.cmti
  $ odoc link -I . other.odoc
  $ odoc html-generate -o . other.odocl --indent
  $ grep To_open x/Other/index.html
        <span> = <a href="../To_open/index.html#type-t">To_open.t</a></span>

Now try again, this time opening 'To_open', and expect the rendered link to be simplified:

  $ odoc compile --package x -I . other.cmti --open To_open
  $ odoc link -I . other.odoc
  $ odoc html-generate -o . other.odocl --indent
  $ grep To_open x/Other/index.html
        <span> = <a href="../To_open/index.html#type-t">t</a></span>