Skip to content

Commit 2096f96

Browse files
committed
Add a test case for references' scope
1 parent 042a1fc commit 2096f96

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

test/xref2/references_scope.t/a.mli

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
(** Text attached to references are written as single words to have a more
2+
readable output.
3+
References from the first comment (which is the doc of the entire module):
4+
{{!B.C}Doc-relative}
5+
{{!A.B.C}Doc-absolute} *)
6+
7+
(** References from inside the module's signature:
8+
{{!B.C}Defined-below}
9+
{{!A.B.C}Defined-below-but-absolute} *)
10+
11+
module B : sig
12+
module C : sig end
13+
end
14+
15+
module D : sig
16+
open B
17+
18+
(** {{!C}Through-open} *)
19+
end

test/xref2/references_scope.t/run.t

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Testing the scope of references
2+
3+
$ compile a.mli
4+
5+
$ jq_scan_references() { jq -c '.. | .["`Reference"]? | select(.)'; }
6+
7+
The references from a.mli, see the attached text to recognize them:
8+
9+
$ odoc_print a.odocl | jq_scan_references
10+
[{"`Dot":[{"`Root":["B","`TUnknown"]},"C"]},[{"`Word":"Doc-relative"}]]
11+
[{"`Resolved":{"`Module":[{"`Module":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"A"]}},"B"]},"C"]}},[{"`Word":"Doc-absolute"}]]
12+
[{"`Resolved":{"`Module":[{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"A"]},"B"]}},"C"]}},[{"`Word":"Defined-below"}]]
13+
[{"`Resolved":{"`Module":[{"`Module":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"A"]}},"B"]},"C"]}},[{"`Word":"Defined-below-but-absolute"}]]
14+
[{"`Root":["C","`TUnknown"]},[{"`Word":"Through-open"}]]

0 commit comments

Comments
 (0)