diff --git a/tests/golden/check-local-refs/config-with-virtual-files.yaml b/tests/golden/check-local-refs/config-with-virtual-files.yaml index 9ca793f7..ff8bb2fb 100644 --- a/tests/golden/check-local-refs/config-with-virtual-files.yaml +++ b/tests/golden/check-local-refs/config-with-virtual-files.yaml @@ -6,6 +6,7 @@ verification: - ../d0f1.md - ../../a.md - b/../../* + - DIR2/ scanners: markdown: diff --git a/tests/golden/check-local-refs/dir1/dir2/d2f1.md b/tests/golden/check-local-refs/dir1/dir2/d2f1.md index fec7fa88..5e9a74ca 100644 --- a/tests/golden/check-local-refs/dir1/dir2/d2f1.md +++ b/tests/golden/check-local-refs/dir1/dir2/d2f1.md @@ -9,16 +9,23 @@ [bad-cf-ref](#bad) # Relative links -[existing-file-rel](d2f2.md) -[existing-file-rel](./d2f2.md) -[existing-file-rel](../dir2/.././d1f1.md) +[existing-file-rel-1](d2f2.md) +[existing-file-rel-2](./d2f2.md) +[existing-file-rel-3](../dir2/.././d1f1.md) +[existing-file-rel-4](d2f3.yaml) +[existing-dir-rel-1](..) +[existing-dir-rel-2](../dir2) +[existing-dir-rel-3](../dir2/) [existing-anchor-rel-1](d2f2.md#existing-anchor-d2f2) [existing-anchor-rel-2](./d2f2.md#existing-anchor-d2f2) [existing-anchor-rel-3](../dir2/../d1f1.md#existing-anchor-d1f1) [bad-file-rel](../a/b/c/unexisting-file.md) +[bad-slash-file-rel](d2f2.md/) +[bad-casing-file-rel](D2F2.md/) +[bad-casing-folder-rel](../DIR2) [bad-anchor-rel-1](d2f2.md#bad-anchor) [bad-anchor-rel-2](unexisting-file.md#bad-anchor) @@ -26,6 +33,8 @@ # Absolute links Should be correct when root is `/tests/golden/check-local-refs`: [file-abs-1](/dir1/./d1f1.md) +[folder-abs-1](/dir1) +[folder-abs-2](/dir1/dir2/../) [anchor-abs-1](/dir1/../dir1/d1f1.md#existing-anchor-d1f1) [anchor-abs-2](/dir1/dir2/../../dir1/./dir2/d2f2.md#existing-anchor-d2f2) Should be correct when root is `/tests/golden/check-local-refs/dir1`: diff --git a/tests/golden/check-local-refs/dir1/dir2/d2f3.yaml b/tests/golden/check-local-refs/dir1/dir2/d2f3.yaml new file mode 100644 index 00000000..e6dc3738 --- /dev/null +++ b/tests/golden/check-local-refs/dir1/dir2/d2f3.yaml @@ -0,0 +1,4 @@ +# SPDX-FileCopyrightText: 2022 Serokell +# +# SPDX-License-Identifier: Unlicense +p: q diff --git a/tests/golden/check-local-refs/expected1.gold b/tests/golden/check-local-refs/expected1.gold index 287397ae..4ff28839 100644 --- a/tests/golden/check-local-refs/expected1.gold +++ b/tests/golden/check-local-refs/expected1.gold @@ -10,7 +10,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (relative) at src:21:1-43: + bad reference (relative) at src:25:1-43: - text: "bad-file-rel" - link: ../a/b/c/unexisting-file.md - anchor: - @@ -20,7 +20,37 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (relative) at src:23:1-38: + bad reference (relative) at src:26:1-30: + - text: "bad-slash-file-rel" + - link: d2f2.md/ + - anchor: - + + ⛀ File does not exist: + dir1/dir2/d2f2.md/ + + + ➥ In file dir1/dir2/d2f1.md + bad reference (relative) at src:27:1-31: + - text: "bad-casing-file-rel" + - link: D2F2.md/ + - anchor: - + + ⛀ File does not exist: + dir1/dir2/D2F2.md/ + + + ➥ In file dir1/dir2/d2f1.md + bad reference (relative) at src:28:1-32: + - text: "bad-casing-folder-rel" + - link: ../DIR2 + - anchor: - + + ⛀ File does not exist: + dir1/dir2/../DIR2 + + + ➥ In file dir1/dir2/d2f1.md + bad reference (relative) at src:30:1-38: - text: "bad-anchor-rel-1" - link: d2f2.md - anchor: bad-anchor @@ -29,7 +59,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (relative) at src:24:1-49: + bad reference (relative) at src:31:1-49: - text: "bad-anchor-rel-2" - link: unexisting-file.md - anchor: bad-anchor @@ -39,7 +69,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (absolute) at src:32:1-22: + bad reference (absolute) at src:41:1-22: - text: "file-abs-2" - link: /d1f1.md - anchor: - @@ -49,7 +79,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (absolute) at src:33:1-27: + bad reference (absolute) at src:42:1-27: - text: "file-abs-3" - link: /dir2/d2f2.md - anchor: - @@ -59,7 +89,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (absolute) at src:34:1-32: + bad reference (absolute) at src:43:1-32: - text: "file-abs-4" - link: /./dir2/../d1f1.md - anchor: - @@ -69,7 +99,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (absolute) at src:35:1-55: + bad reference (absolute) at src:44:1-55: - text: "anchor-abs-3" - link: /./dir2/../d1f1.md - anchor: existing-anchor-d1f1 @@ -79,7 +109,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (absolute) at src:46:1-16: + bad reference (absolute) at src:55:1-16: - text: "A" - link: /../../a.md - anchor: - @@ -89,7 +119,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (absolute) at src:47:1-18: + bad reference (absolute) at src:56:1-18: - text: "B" - link: /b/../../b.md - anchor: - @@ -98,4 +128,4 @@ ./b/../../b.md -Invalid references dumped, 10 in total. +Invalid references dumped, 13 in total. diff --git a/tests/golden/check-local-refs/expected2.gold b/tests/golden/check-local-refs/expected2.gold index cbfd3e57..d8e6bdd5 100644 --- a/tests/golden/check-local-refs/expected2.gold +++ b/tests/golden/check-local-refs/expected2.gold @@ -10,7 +10,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (relative) at src:21:1-43: + bad reference (relative) at src:25:1-43: - text: "bad-file-rel" - link: ../a/b/c/unexisting-file.md - anchor: - @@ -20,7 +20,37 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (relative) at src:23:1-38: + bad reference (relative) at src:26:1-30: + - text: "bad-slash-file-rel" + - link: d2f2.md/ + - anchor: - + + ⛀ File does not exist: + dir1/dir2/d2f2.md/ + + + ➥ In file dir1/dir2/d2f1.md + bad reference (relative) at src:27:1-31: + - text: "bad-casing-file-rel" + - link: D2F2.md/ + - anchor: - + + ⛀ File does not exist: + dir1/dir2/D2F2.md/ + + + ➥ In file dir1/dir2/d2f1.md + bad reference (relative) at src:28:1-32: + - text: "bad-casing-folder-rel" + - link: ../DIR2 + - anchor: - + + ⛀ File does not exist: + dir1/dir2/../DIR2 + + + ➥ In file dir1/dir2/d2f1.md + bad reference (relative) at src:30:1-38: - text: "bad-anchor-rel-1" - link: d2f2.md - anchor: bad-anchor @@ -29,7 +59,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (relative) at src:24:1-49: + bad reference (relative) at src:31:1-49: - text: "bad-anchor-rel-2" - link: unexisting-file.md - anchor: bad-anchor @@ -39,7 +69,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (absolute) at src:28:1-29: + bad reference (absolute) at src:35:1-29: - text: "file-abs-1" - link: /dir1/./d1f1.md - anchor: - @@ -49,7 +79,27 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (absolute) at src:29:1-58: + bad reference (absolute) at src:36:1-21: + - text: "folder-abs-1" + - link: /dir1 + - anchor: - + + ⛀ File does not exist: + dir1/dir1 + + + ➥ In file dir1/dir2/d2f1.md + bad reference (absolute) at src:37:1-30: + - text: "folder-abs-2" + - link: /dir1/dir2/../ + - anchor: - + + ⛀ File does not exist: + dir1/dir1/dir2/../ + + + ➥ In file dir1/dir2/d2f1.md + bad reference (absolute) at src:38:1-58: - text: "anchor-abs-1" - link: /dir1/../dir1/d1f1.md - anchor: existing-anchor-d1f1 @@ -59,7 +109,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (absolute) at src:30:1-73: + bad reference (absolute) at src:39:1-73: - text: "anchor-abs-2" - link: /dir1/dir2/../../dir1/./dir2/d2f2.md - anchor: existing-anchor-d2f2 @@ -69,7 +119,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (relative) at src:40:1-42: + bad reference (relative) at src:49:1-42: - text: "path-through-top-dir" - link: ../../dir1/d1f1.md - anchor: - @@ -79,7 +129,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (relative) at src:41:1-75: + bad reference (relative) at src:50:1-75: - text: "path-through-top-dir-with-anchor" - link: ../../dir1/d1f1.md - anchor: existing-anchor-d1f1 @@ -89,7 +139,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (relative) at src:42:1-26: + bad reference (relative) at src:51:1-26: - text: "ref-to-d0" - link: ../../d0f1.md - anchor: - @@ -99,7 +149,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (absolute) at src:46:1-16: + bad reference (absolute) at src:55:1-16: - text: "A" - link: /../../a.md - anchor: - @@ -109,7 +159,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (absolute) at src:47:1-18: + bad reference (absolute) at src:56:1-18: - text: "B" - link: /b/../../b.md - anchor: - @@ -118,4 +168,4 @@ dir1/b/../../b.md -Invalid references dumped, 12 in total. +Invalid references dumped, 17 in total. diff --git a/tests/golden/check-local-refs/expected3.gold b/tests/golden/check-local-refs/expected3.gold index 05c42c2b..ccbf2622 100644 --- a/tests/golden/check-local-refs/expected3.gold +++ b/tests/golden/check-local-refs/expected3.gold @@ -10,7 +10,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (relative) at src:21:1-43: + bad reference (relative) at src:25:1-43: - text: "bad-file-rel" - link: ../a/b/c/unexisting-file.md - anchor: - @@ -20,7 +20,27 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (relative) at src:23:1-38: + bad reference (relative) at src:26:1-30: + - text: "bad-slash-file-rel" + - link: d2f2.md/ + - anchor: - + + ⛀ File does not exist: + dir1/dir2/d2f2.md/ + + + ➥ In file dir1/dir2/d2f1.md + bad reference (relative) at src:27:1-31: + - text: "bad-casing-file-rel" + - link: D2F2.md/ + - anchor: - + + ⛀ File does not exist: + dir1/dir2/D2F2.md/ + + + ➥ In file dir1/dir2/d2f1.md + bad reference (relative) at src:30:1-38: - text: "bad-anchor-rel-1" - link: d2f2.md - anchor: bad-anchor @@ -29,7 +49,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (relative) at src:24:1-49: + bad reference (relative) at src:31:1-49: - text: "bad-anchor-rel-2" - link: unexisting-file.md - anchor: bad-anchor @@ -39,7 +59,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (absolute) at src:28:1-29: + bad reference (absolute) at src:35:1-29: - text: "file-abs-1" - link: /dir1/./d1f1.md - anchor: - @@ -49,7 +69,27 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (absolute) at src:29:1-58: + bad reference (absolute) at src:36:1-21: + - text: "folder-abs-1" + - link: /dir1 + - anchor: - + + ⛀ File does not exist: + dir1/dir1 + + + ➥ In file dir1/dir2/d2f1.md + bad reference (absolute) at src:37:1-30: + - text: "folder-abs-2" + - link: /dir1/dir2/../ + - anchor: - + + ⛀ File does not exist: + dir1/dir1/dir2/../ + + + ➥ In file dir1/dir2/d2f1.md + bad reference (absolute) at src:38:1-58: - text: "anchor-abs-1" - link: /dir1/../dir1/d1f1.md - anchor: existing-anchor-d1f1 @@ -59,7 +99,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (absolute) at src:30:1-73: + bad reference (absolute) at src:39:1-73: - text: "anchor-abs-2" - link: /dir1/dir2/../../dir1/./dir2/d2f2.md - anchor: existing-anchor-d2f2 @@ -69,7 +109,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (relative) at src:40:1-42: + bad reference (relative) at src:49:1-42: - text: "path-through-top-dir" - link: ../../dir1/d1f1.md - anchor: - @@ -79,7 +119,7 @@ ➥ In file dir1/dir2/d2f1.md - bad reference (relative) at src:41:1-75: + bad reference (relative) at src:50:1-75: - text: "path-through-top-dir-with-anchor" - link: ../../dir1/d1f1.md - anchor: existing-anchor-d1f1 @@ -88,4 +128,4 @@ dir1/dir2/../../dir1/d1f1.md -Invalid references dumped, 9 in total. +Invalid references dumped, 13 in total.