Skip to content

Commit a03c9ff

Browse files
committed
fixup! [#165] [#192] Add tests for specific cases
1 parent 22b3ce1 commit a03c9ff

4 files changed

Lines changed: 97 additions & 62 deletions

File tree

‎tests/golden/check-local-refs/dir1/dir2/d2f1.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
[existing-file-rel-3](../dir2/.././d1f1.md)
1515
[existing-file-rel-4](d2f3.yaml)
1616

17+
Currently our behavior is wrong, see https://github.com/serokell/xrefcheck/issues/195
18+
[slash-file-rel](d2f2.md/)
19+
20+
21+
1722
[existing-dir-rel-1](..)
1823
[existing-dir-rel-2](../dir2)
1924
[existing-dir-rel-3](../dir2/)
@@ -23,7 +28,6 @@
2328
[existing-anchor-rel-3](../dir2/../d1f1.md#existing-anchor-d1f1)
2429

2530
[bad-file-rel](../a/b/c/unexisting-file.md)
26-
[bad-slash-file-rel](d2f2.md/)
2731
[bad-casing-file-rel](D2F2.md/)
2832
[bad-casing-folder-rel](../DIR2)
2933

@@ -41,6 +45,7 @@ Should be correct when root is `/tests/golden/check-local-refs/dir1`:
4145
[file-abs-2](/d1f1.md)
4246
[file-abs-3](/dir2/d2f2.md)
4347
[file-abs-4](/./dir2/../d1f1.md)
48+
[file-abs-slash](/./dir2/../d1f1.md/)
4449
[anchor-abs-3](/./dir2/../d1f1.md#existing-anchor-d1f1)
4550

4651
# Test references outside repo

‎tests/golden/check-local-refs/expected1.gold‎

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@
1010

1111

1212
➥ In file dir1/dir2/d2f1.md
13-
bad reference (relative) at src:25:1-43:
14-
- text: "bad-file-rel"
15-
- link: ../a/b/c/unexisting-file.md
13+
bad reference (relative) at src:18:1-26:
14+
- text: "slash-file-rel"
15+
- link: d2f2.md/
1616
- anchor: -
1717

1818
⛀ File does not exist:
19-
dir1/dir2/../a/b/c/unexisting-file.md
19+
dir1/dir2/d2f2.md/
2020

2121

2222
➥ In file dir1/dir2/d2f1.md
23-
bad reference (relative) at src:26:1-30:
24-
- text: "bad-slash-file-rel"
25-
- link: d2f2.md/
23+
bad reference (relative) at src:30:1-43:
24+
- text: "bad-file-rel"
25+
- link: ../a/b/c/unexisting-file.md
2626
- anchor: -
2727

2828
⛀ File does not exist:
29-
dir1/dir2/d2f2.md/
29+
dir1/dir2/../a/b/c/unexisting-file.md
3030

3131

3232
➥ In file dir1/dir2/d2f1.md
33-
bad reference (relative) at src:27:1-31:
33+
bad reference (relative) at src:31:1-31:
3434
- text: "bad-casing-file-rel"
3535
- link: D2F2.md/
3636
- anchor: -
@@ -40,7 +40,7 @@
4040

4141

4242
➥ In file dir1/dir2/d2f1.md
43-
bad reference (relative) at src:28:1-32:
43+
bad reference (relative) at src:32:1-32:
4444
- text: "bad-casing-folder-rel"
4545
- link: ../DIR2
4646
- anchor: -
@@ -50,7 +50,7 @@
5050

5151

5252
➥ In file dir1/dir2/d2f1.md
53-
bad reference (relative) at src:30:1-38:
53+
bad reference (relative) at src:34:1-38:
5454
- text: "bad-anchor-rel-1"
5555
- link: d2f2.md
5656
- anchor: bad-anchor
@@ -59,7 +59,7 @@
5959

6060

6161
➥ In file dir1/dir2/d2f1.md
62-
bad reference (relative) at src:31:1-49:
62+
bad reference (relative) at src:35:1-49:
6363
- text: "bad-anchor-rel-2"
6464
- link: unexisting-file.md
6565
- anchor: bad-anchor
@@ -69,7 +69,7 @@
6969

7070

7171
➥ In file dir1/dir2/d2f1.md
72-
bad reference (absolute) at src:41:1-22:
72+
bad reference (absolute) at src:45:1-22:
7373
- text: "file-abs-2"
7474
- link: /d1f1.md
7575
- anchor: -
@@ -79,7 +79,7 @@
7979

8080

8181
➥ In file dir1/dir2/d2f1.md
82-
bad reference (absolute) at src:42:1-27:
82+
bad reference (absolute) at src:46:1-27:
8383
- text: "file-abs-3"
8484
- link: /dir2/d2f2.md
8585
- anchor: -
@@ -89,7 +89,7 @@
8989

9090

9191
➥ In file dir1/dir2/d2f1.md
92-
bad reference (absolute) at src:43:1-32:
92+
bad reference (absolute) at src:47:1-32:
9393
- text: "file-abs-4"
9494
- link: /./dir2/../d1f1.md
9595
- anchor: -
@@ -99,7 +99,17 @@
9999

100100

101101
➥ In file dir1/dir2/d2f1.md
102-
bad reference (absolute) at src:44:1-55:
102+
bad reference (absolute) at src:48:1-37:
103+
- text: "file-abs-slash"
104+
- link: /./dir2/../d1f1.md/
105+
- anchor: -
106+
107+
⛀ File does not exist:
108+
././dir2/../d1f1.md/
109+
110+
111+
➥ In file dir1/dir2/d2f1.md
112+
bad reference (absolute) at src:49:1-55:
103113
- text: "anchor-abs-3"
104114
- link: /./dir2/../d1f1.md
105115
- anchor: existing-anchor-d1f1
@@ -109,7 +119,7 @@
109119

110120

111121
➥ In file dir1/dir2/d2f1.md
112-
bad reference (absolute) at src:55:1-16:
122+
bad reference (absolute) at src:60:1-16:
113123
- text: "A"
114124
- link: /../../a.md
115125
- anchor: -
@@ -119,7 +129,7 @@
119129

120130

121131
➥ In file dir1/dir2/d2f1.md
122-
bad reference (absolute) at src:56:1-18:
132+
bad reference (absolute) at src:61:1-18:
123133
- text: "B"
124134
- link: /b/../../b.md
125135
- anchor: -
@@ -128,4 +138,4 @@
128138
./b/../../b.md
129139

130140

131-
Invalid references dumped, 13 in total.
141+
Invalid references dumped, 14 in total.

‎tests/golden/check-local-refs/expected2.gold‎

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@
1010

1111

1212
➥ In file dir1/dir2/d2f1.md
13-
bad reference (relative) at src:25:1-43:
14-
- text: "bad-file-rel"
15-
- link: ../a/b/c/unexisting-file.md
13+
bad reference (relative) at src:18:1-26:
14+
- text: "slash-file-rel"
15+
- link: d2f2.md/
1616
- anchor: -
1717

1818
⛀ File does not exist:
19-
dir1/dir2/../a/b/c/unexisting-file.md
19+
dir1/dir2/d2f2.md/
2020

2121

2222
➥ In file dir1/dir2/d2f1.md
23-
bad reference (relative) at src:26:1-30:
24-
- text: "bad-slash-file-rel"
25-
- link: d2f2.md/
23+
bad reference (relative) at src:30:1-43:
24+
- text: "bad-file-rel"
25+
- link: ../a/b/c/unexisting-file.md
2626
- anchor: -
2727

2828
⛀ File does not exist:
29-
dir1/dir2/d2f2.md/
29+
dir1/dir2/../a/b/c/unexisting-file.md
3030

3131

3232
➥ In file dir1/dir2/d2f1.md
33-
bad reference (relative) at src:27:1-31:
33+
bad reference (relative) at src:31:1-31:
3434
- text: "bad-casing-file-rel"
3535
- link: D2F2.md/
3636
- anchor: -
@@ -40,7 +40,7 @@
4040

4141

4242
➥ In file dir1/dir2/d2f1.md
43-
bad reference (relative) at src:28:1-32:
43+
bad reference (relative) at src:32:1-32:
4444
- text: "bad-casing-folder-rel"
4545
- link: ../DIR2
4646
- anchor: -
@@ -50,7 +50,7 @@
5050

5151

5252
➥ In file dir1/dir2/d2f1.md
53-
bad reference (relative) at src:30:1-38:
53+
bad reference (relative) at src:34:1-38:
5454
- text: "bad-anchor-rel-1"
5555
- link: d2f2.md
5656
- anchor: bad-anchor
@@ -59,7 +59,7 @@
5959

6060

6161
➥ In file dir1/dir2/d2f1.md
62-
bad reference (relative) at src:31:1-49:
62+
bad reference (relative) at src:35:1-49:
6363
- text: "bad-anchor-rel-2"
6464
- link: unexisting-file.md
6565
- anchor: bad-anchor
@@ -69,7 +69,7 @@
6969

7070

7171
➥ In file dir1/dir2/d2f1.md
72-
bad reference (absolute) at src:35:1-29:
72+
bad reference (absolute) at src:39:1-29:
7373
- text: "file-abs-1"
7474
- link: /dir1/./d1f1.md
7575
- anchor: -
@@ -79,7 +79,7 @@
7979

8080

8181
➥ In file dir1/dir2/d2f1.md
82-
bad reference (absolute) at src:36:1-21:
82+
bad reference (absolute) at src:40:1-21:
8383
- text: "folder-abs-1"
8484
- link: /dir1
8585
- anchor: -
@@ -89,7 +89,7 @@
8989

9090

9191
➥ In file dir1/dir2/d2f1.md
92-
bad reference (absolute) at src:37:1-30:
92+
bad reference (absolute) at src:41:1-30:
9393
- text: "folder-abs-2"
9494
- link: /dir1/dir2/../
9595
- anchor: -
@@ -99,7 +99,7 @@
9999

100100

101101
➥ In file dir1/dir2/d2f1.md
102-
bad reference (absolute) at src:38:1-58:
102+
bad reference (absolute) at src:42:1-58:
103103
- text: "anchor-abs-1"
104104
- link: /dir1/../dir1/d1f1.md
105105
- anchor: existing-anchor-d1f1
@@ -109,7 +109,7 @@
109109

110110

111111
➥ In file dir1/dir2/d2f1.md
112-
bad reference (absolute) at src:39:1-73:
112+
bad reference (absolute) at src:43:1-73:
113113
- text: "anchor-abs-2"
114114
- link: /dir1/dir2/../../dir1/./dir2/d2f2.md
115115
- anchor: existing-anchor-d2f2
@@ -119,7 +119,17 @@
119119

120120

121121
➥ In file dir1/dir2/d2f1.md
122-
bad reference (relative) at src:49:1-42:
122+
bad reference (absolute) at src:48:1-37:
123+
- text: "file-abs-slash"
124+
- link: /./dir2/../d1f1.md/
125+
- anchor: -
126+
127+
⛀ File does not exist:
128+
dir1/./dir2/../d1f1.md/
129+
130+
131+
➥ In file dir1/dir2/d2f1.md
132+
bad reference (relative) at src:54:1-42:
123133
- text: "path-through-top-dir"
124134
- link: ../../dir1/d1f1.md
125135
- anchor: -
@@ -129,7 +139,7 @@
129139

130140

131141
➥ In file dir1/dir2/d2f1.md
132-
bad reference (relative) at src:50:1-75:
142+
bad reference (relative) at src:55:1-75:
133143
- text: "path-through-top-dir-with-anchor"
134144
- link: ../../dir1/d1f1.md
135145
- anchor: existing-anchor-d1f1
@@ -139,7 +149,7 @@
139149

140150

141151
➥ In file dir1/dir2/d2f1.md
142-
bad reference (relative) at src:51:1-26:
152+
bad reference (relative) at src:56:1-26:
143153
- text: "ref-to-d0"
144154
- link: ../../d0f1.md
145155
- anchor: -
@@ -149,7 +159,7 @@
149159

150160

151161
➥ In file dir1/dir2/d2f1.md
152-
bad reference (absolute) at src:55:1-16:
162+
bad reference (absolute) at src:60:1-16:
153163
- text: "A"
154164
- link: /../../a.md
155165
- anchor: -
@@ -159,7 +169,7 @@
159169

160170

161171
➥ In file dir1/dir2/d2f1.md
162-
bad reference (absolute) at src:56:1-18:
172+
bad reference (absolute) at src:61:1-18:
163173
- text: "B"
164174
- link: /b/../../b.md
165175
- anchor: -
@@ -168,4 +178,4 @@
168178
dir1/b/../../b.md
169179

170180

171-
Invalid references dumped, 17 in total.
181+
Invalid references dumped, 18 in total.

0 commit comments

Comments
 (0)