Skip to content

Commit e4a86e6

Browse files
committed
add test
Signed-off-by: lubegasimon <lubegasimon73@gmail.com>
1 parent f10fdfa commit e4a86e6

File tree

12 files changed

+124
-0
lines changed

12 files changed

+124
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
(** *)
2+
3+
(** Page not found: {!page-"not_found"} *)
4+
5+
(** Explicit label in page but not found: {!page-"p-foo".section-not_found} *)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
type t
2+
3+
(** {!page-"p-foo"}
4+
Label in page: {!page-"p-foo".P1} {!page-"p-foo".P2} *)
5+
6+
(** Explicit label in page: {!page-"p-foo".section-P1} *)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{0 Page1}
2+
3+
{1:P1 Label1}
4+
5+
{1:P2 Label2}
6+
7+
{!M} {!M.t}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# References to pages and items in pages
2+
3+
$ compile p-foo.mld good_references.mli bad_references.mli
4+
5+
Every references in `Good_references` should resolve:
6+
7+
$ jq_scan_references() { jq -c '.. | .["`Reference"]? | select(.) | .[0]'; }
8+
9+
$ odoc_print good_references.odocl | jq_scan_references
10+
{"`Resolved":{"`Identifier":{"`LeafPage":[{"`RootPage":"test"},"p-foo"]}}}
11+
{"`Resolved":{"`Identifier":{"`Label":[{"`LeafPage":[{"`RootPage":"test"},"p-foo"]},"P1"]}}}
12+
{"`Resolved":{"`Identifier":{"`Label":[{"`LeafPage":[{"`RootPage":"test"},"p-foo"]},"P2"]}}}
13+
{"`Resolved":{"`Identifier":{"`Label":[{"`LeafPage":[{"`RootPage":"test"},"p-foo"]},"P1"]}}}
14+
15+
Every references in `Bad_references` should not:
16+
17+
$ odoc_print bad_references.odocl | jq_scan_references
18+
{"`Root":["not_found","`TPage"]}
19+
{"`Label":[{"`Root":["p-foo","`TPage"]},"not_found"]}
20+
21+
Every references in `p-foo` should resolve:
22+
23+
$ odoc_print page-p-foo.odocl | jq_scan_references
24+
{"`Root":["M","`TUnknown"]}
25+
{"`Dot":[{"`Root":["M","`TUnknown"]},"t"]}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
(** *)
2+
3+
(** Page not found: {!"not_found"} *)
4+
5+
(** Explicit label in page but not found: {!"foo"."bar".section-not_found} *)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{0 Page1}
2+
3+
{1:P1 Label1}
4+
5+
{1:P2 Label2}
6+
7+
{!M} {!M.t}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
type t
2+
3+
(** {!"foo"."bar"}
4+
Label in page: {!"foo"."bar".P1} {!"foo"."bar".P2} *)
5+
6+
(** Explicit label in page: {!"foo"."bar".section-P1} *)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# References to pages and items in pages
2+
3+
$ compile foo.bar.mld good_references.mli bad_references.mli
4+
5+
Every references in `Good_references` should resolve:
6+
7+
$ jq_scan_references() { jq -c '.. | .["`Reference"]? | select(.) | .[0]'; }
8+
9+
$ odoc_print good_references.odocl | jq_scan_references
10+
11+
12+
Every references in `Bad_references` should not:
13+
14+
$ odoc_print bad_references.odocl | jq_scan_references
15+
16+
17+
Every references in `foo.bar` should resolve:
18+
19+
$ odoc_print foo.bar.odocl | jq_scan_references
20+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
(** *)
2+
3+
(** Page not found: {!page-"not_found"} *)
4+
5+
(** Explicit label in page but not found: {!page-"p-1.2.3".section-not_found} *)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
type t
2+
3+
(** {!page-"p-1.2.3"}
4+
Label in page: {!page-"p-1.2.3".P1} {!page-"p-1.2.3".P2} *)
5+
6+
(** Explicit label in page: {!page-"p-1.2.3".section-P1} *)

0 commit comments

Comments
 (0)