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 (53 lines) | stat: -rw-r--r-- 1,239 bytes parent folder | download
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
This test checks that when we have expressions of the form `sig ... end with ...` that we replace
them with simple `sig ... end` - any types or modules referred to in the `with` clauses will not
be able to link anywhere because we don't render the inner signature anywhere.

  $ cat test.ml
  module type S = sig
    type t
    type u
  end with type t = int with type u = int
  

  $ cat compile.sh
  #!/bin/sh
  
  ocamlc -c -bin-annot test.ml
  odoc compile page.mld --child module-test
  odoc compile -I . --parent page test.cmt
  odoc link -I . test.odoc
  odoc html-generate --indent -o html test.odocl
  odoc support-files -o html
  

  $ ./compile.sh

Let's check which module type `.content.Module.items[0].ModuleType` refers to:

  $ odoc_print test.odocl | jq '.content.Module.items[0].ModuleType.id' 
  {
    "`ModuleType": [
      {
        "`Root": [
          {
            "Some": {
              "`Page": [
                "None",
                "page"
              ]
            }
          },
          "Test"
        ]
      },
      "S"
    ]
  }

And it ought to still be a With after compiling and linking.

  $ odoc_print test.odocl | jq '.content.Module.items[0].ModuleType.expr.Some | keys'
  [
    "With"
  ]