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 (35 lines) | stat: -rw-r--r-- 2,790 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
# Testing the scope of references

  $ compile a.mli shadowed.mli shadowed_through_open.mli
  File "a.mli", line 18, characters 6-24:
  Warning: Failed to resolve reference unresolvedroot(C) Couldn't find "C"

  $ jq_scan_references() { jq -c '.. | .["`Reference"]? | select(.)'; }

The references from a.mli, see the attached text to recognize them:

  $ odoc_print a.odocl | jq_scan_references
  [{"`Resolved":{"`Module":[{"`Identifier":{"`Module":[{"`Root":[{"Some":{"`Page":["None","test"]}},"A"]},"B"]}},"C"]}},[{"`Word":"Defined-below"}]]
  [{"`Resolved":{"`Module":[{"`Module":[{"`Identifier":{"`Root":[{"Some":{"`Page":["None","test"]}},"A"]}},"B"]},"C"]}},[{"`Word":"Defined-below-but-absolute"}]]
  [{"`Root":["C","`TUnknown"]},[{"`Word":"Through-open"}]]
  [{"`Resolved":{"`Module":[{"`Identifier":{"`Module":[{"`Root":[{"Some":{"`Page":["None","test"]}},"A"]},"B"]}},"C"]}},[{"`Word":"Doc-relative"}]]
  [{"`Resolved":{"`Module":[{"`Module":[{"`Identifier":{"`Root":[{"Some":{"`Page":["None","test"]}},"A"]}},"B"]},"C"]}},[{"`Word":"Doc-absolute"}]]

References should be resolved after the whole signature has been added to the
scope. Both "Before-shadowed" and "After-shadowed" should resolve to [M.t].

  $ odoc_print shadowed.odocl | jq_scan_references
  [{"`Resolved":{"`Identifier":{"`Type":[{"`Module":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Shadowed"]},"M"]},"t"]}}},[{"`Word":"Before-shadowed"}]]
  [{"`Resolved":{"`Type":[{"`Identifier":{"`Root":[{"Some":{"`Page":["None","test"]}},"Shadowed"]}},"t"]}},[]]
  [{"`Resolved":{"`Identifier":{"`Type":[{"`Module":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Shadowed"]},"M"]},"t"]}}},[{"`Word":"After-shadowed"}]]
  [{"`Resolved":{"`Identifier":{"`Value":[{"`Module":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Shadowed"]},"N"]},"f"]}}},[]]
  [{"`Resolved":{"`Value":[{"`Identifier":{"`Root":[{"Some":{"`Page":["None","test"]}},"Shadowed"]}},"f"]}},[]]

"Before-open" and "After-open" should resolve to to [T.t].
"Before-include" and "After-include" should resolve to [Through_include.t].

  $ odoc_print shadowed_through_open.odocl | jq_scan_references
  [{"`Resolved":{"`Identifier":{"`Type":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Shadowed_through_open"]},"t"]}}},[{"`Word":"Before-open"}]]
  [{"`Resolved":{"`Identifier":{"`Type":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Shadowed_through_open"]},"t"]}}},[{"`Word":"After-open"}]]
  [{"`Resolved":{"`Identifier":{"`Type":[{"`Module":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Shadowed_through_open"]},"Through_include"]},"t"]}}},[{"`Word":"Before-include"}]]
  [{"`Resolved":{"`Identifier":{"`Type":[{"`Module":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Shadowed_through_open"]},"Through_include"]},"t"]}}},[{"`Word":"After-include"}]]