@@ -7,7 +7,7 @@ normalize_newlines(s::AbstractString) = replace(s, "\r\n" => "\n")
7
7
8
8
@testset " walkdocs" begin
9
9
let fileinfos = DocumenterTools. FileInfo[]
10
- rs = DocumenterTools. walkdocs (joinpath (FIXTURES, " pre" )) do fileinfo
10
+ rs = DocumenterTools. walkdocs (joinpath (FIXTURES, " simple. pre" )) do fileinfo
11
11
push! (fileinfos, fileinfo)
12
12
@test isabspath (fileinfo. root)
13
13
@test isabspath (fileinfo. fullpath)
@@ -20,7 +20,7 @@ normalize_newlines(s::AbstractString) = replace(s, "\r\n" => "\n")
20
20
21
21
let fileinfos = []
22
22
rs = DocumenterTools. walkdocs (
23
- joinpath (FIXTURES, " pre" ),
23
+ joinpath (FIXTURES, " simple. pre" ),
24
24
DocumenterTools. isdochtml,
25
25
) do fileinfo
26
26
push! (fileinfos, fileinfo)
@@ -33,7 +33,10 @@ normalize_newlines(s::AbstractString) = replace(s, "\r\n" => "\n")
33
33
@test length (fileinfos) == 6
34
34
end
35
35
36
- let rs = DocumenterTools. walkdocs (joinpath (FIXTURES, " pre" ), collect = true ) do fileinfo
36
+ let rs = DocumenterTools. walkdocs (
37
+ joinpath (FIXTURES, " simple.pre" ),
38
+ collect = true ,
39
+ ) do fileinfo
37
40
fileinfo. root
38
41
end
39
42
@test length (rs) == 9
@@ -115,16 +118,16 @@ end
115
118
end
116
119
end
117
120
118
- @testset " update_canonical_links" begin
121
+ @testset " update_canonical_links: simple " begin
119
122
out = tempname ()
120
- cp (joinpath (FIXTURES, " pre" ), out)
123
+ cp (joinpath (FIXTURES, " simple. pre" ), out)
121
124
@test DocumenterTools. canonical_directory_from_redirect_index_html (out) ==
122
125
[" stable" ]
123
126
DocumenterTools. update_canonical_links (
124
127
out;
125
128
canonical = " https://example.org/this-is-test" ,
126
129
)
127
- DocumenterTools. walkdocs (joinpath (FIXTURES, " post" )) do fileinfo
130
+ DocumenterTools. walkdocs (joinpath (FIXTURES, " simple. post" )) do fileinfo
128
131
post = normalize_newlines (read (fileinfo. fullpath, String))
129
132
changed = normalize_newlines (read (joinpath (out, fileinfo. relpath), String))
130
133
if changed != post
137
140
# directory, remove index.html and instead use versions.js to determine the stable link
138
141
# For that we also need to make sure that stable/ is a symlink
139
142
out = tempname ()
140
- cp (joinpath (FIXTURES, " pre" ), out)
143
+ cp (joinpath (FIXTURES, " simple. pre" ), out)
141
144
rm (joinpath (out, " index.html" ))
142
145
rm (joinpath (out, " stable" ), recursive = true )
143
146
symlink (joinpath (out, " v0.5.0" ), joinpath (out, " stable" ))
158
161
out;
159
162
canonical = " https://example.org/this-is-test" ,
160
163
)
161
- DocumenterTools. walkdocs (joinpath (FIXTURES, " post" )) do fileinfo
164
+ DocumenterTools. walkdocs (joinpath (FIXTURES, " simple. post" )) do fileinfo
162
165
# We removed the root /index.html redirect file, so we skip testing it
163
166
(fileinfo. relpath == " index.html" ) && return
164
167
# We also don't check the stable/ symlink.
173
176
@test changed == post
174
177
end
175
178
end
179
+
180
+ # Testing the case where index.html does not have a meta redirect
181
+ @testset " update_canonical_links: nometa" begin
182
+ out = tempname ()
183
+ cp (joinpath (FIXTURES, " nometa.pre" ), out)
184
+ @test DocumenterTools. canonical_directory_from_redirect_index_html (out) === nothing
185
+ @test DocumenterTools. canonical_version_from_versions_js (out) == " stable"
186
+ # Just
187
+ @test DocumenterTools. update_canonical_links (
188
+ out;
189
+ canonical = " https://example.org/this-is-test" ,
190
+ ) === nothing
191
+ end
176
192
end
0 commit comments