Skip to content

Commit c10fb42

Browse files
committed
asset reference test: compatiblity
Signed-off-by: Paul-Elliot <[email protected]>
1 parent 102e8dd commit c10fb42

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

src/xref2/ref_tools.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,7 @@ module A = struct
515515
let has_asset children asset =
516516
List.exists
517517
(function
518-
| Odoc_model.Lang.Page.Asset_child a -> String.equal a asset
519-
| _ -> false)
518+
| Odoc_model.Lang.Page.Asset_child a -> a = asset | _ -> false)
520519
children
521520
in
522521
let parent_id

test/xref2/references_to_assets.t/run.t

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ children. If we omit the asset child, all assets reference resolving fail:
1616
$ odoc compile index.mld --child module-test --child page-other_page
1717
$ odoc compile other_page.mld -I . --parent index
1818
$ odoc compile test.cmti -I . --parent index
19-
$ for i in *.odoc; do odoc link -I . $i; done
19+
$ odoc link -I . test.odoc
20+
File "test.mli", line 5, characters 39-78:
21+
Warning: Failed to resolve reference unresolvedroot(other_page).caml_not.gif Couldn't find asset "caml_not.gif"
22+
File "test.mli", line 3, characters 4-34:
23+
Warning: Failed to resolve reference unresolvedroot(caml.gif) Couldn't find asset "caml.gif"
24+
$ odoc link -I . page-index.odoc
2025
File "index.mld", line 10, characters 2-15:
2126
Warning: Failed to resolve reference unresolvedroot(caml.gif) Couldn't find "caml.gif"
2227
File "index.mld", line 9, characters 2-36:
@@ -29,12 +34,9 @@ children. If we omit the asset child, all assets reference resolving fail:
2934
Warning: Failed to resolve reference unresolvedroot(other_page).caml_not.gif Couldn't find asset "caml_not.gif"
3035
File "index.mld", line 3, characters 2-32:
3136
Warning: Failed to resolve reference unresolvedroot(caml.gif) Couldn't find asset "caml.gif"
37+
$ odoc link -I . page-other_page.odoc
3238
File "other_page.mld", line 3, characters 22-41:
3339
Warning: Failed to resolve reference unresolvedroot(caml.gif) Couldn't find asset "caml.gif"
34-
File "test.mli", line 4, characters 39-78:
35-
Warning: Failed to resolve reference unresolvedroot(other_page).caml_not.gif Couldn't find asset "caml_not.gif"
36-
File "test.mli", line 2, characters 4-34:
37-
Warning: Failed to resolve reference unresolvedroot(caml.gif) Couldn't find asset "caml.gif"
3840

3941
We should pass the asset as child of a page.
4042

@@ -62,8 +64,8 @@ Note that the html links are correct (there are dead links due to missing assets
6264
<li><a href="other_page/caml_not.gif"><code>caml_not.gif</code></a></li>
6365
<li><a href="other_page/caml_not.gif"><code>caml_not.gif</code></a></li>
6466
$ grep caml.gif html/index/Test/index.html
65-
<p>A <a href="../caml.gif" title="caml.gif">reference</a> to an asset</p>
67+
<p>A <a href="../caml.gif" title="caml.gif">reference</a> to an asset
6668
$ grep caml_not.gif html/index/Test/index.html
67-
<a href="../other_page/caml_not.gif"><code>caml_not.gif</code></a>
69+
<a href="../other_page/caml_not.gif"><code>caml_not.gif</code></a>
6870
$ grep caml.gif html/index/other_page/index.html
6971
<p>Hello darkness my old <a href="../caml.gif"><code>caml.gif</code></a>.

test/xref2/references_to_assets.t/test.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
val x : int
12
(**
23
A {{!asset-"caml.gif"}reference} to an asset
34

0 commit comments

Comments
 (0)