@@ -84,6 +84,30 @@ docs = [
8484 # giturl = "[email protected] :JuliaComputing/DataSets.jl.git", 8585 ),
8686]
87+
88+ # We do not support deploying docs on Windows at the moment, and MultiDocumenter
89+ # should throw an error if it's being run on Windows (in a non-interactive session).
90+ # See also: https://github.com/JuliaComputing/MultiDocumenter.jl/issues/70
91+ if Sys. iswindows () && ! isinteractive ()
92+ @test_throws ErrorException MultiDocumenter. make (
93+ outpath,
94+ docs;
95+ search_engine = MultiDocumenter. SearchConfig (
96+ index_versions = [" stable" , " dev" ],
97+ engine = MultiDocumenter. FlexSearch,
98+ ),
99+ custom_scripts = [
100+ " foo/bar.js" ,
101+ " https://foo.com/bar.js" ,
102+ Docs. HTML (" const foo = 'bar';" ),
103+ ],
104+ rootpath = rootpath,
105+ canonical_domain = " https://example.org/" ,
106+ sitemap = true ,
107+ sitemap_filename = " sitemap-mydocs.xml" ,
108+ )
109+ end
110+
87111MultiDocumenter. make (
88112 outpath,
89113 docs;
@@ -100,15 +124,25 @@ MultiDocumenter.make(
100124 canonical_domain = " https://example.org/" ,
101125 sitemap = true ,
102126 sitemap_filename = " sitemap-mydocs.xml" ,
127+ # The following keyword is not standard:
128+ _override_windows_isinteractive_check = Sys. iswindows (),
103129)
104130
105131@testset " MultiDocumenter.jl" begin
106132
107133 @testset " structure" begin
108134 @test isdir (outpath, " inf" )
109135 @test ! isdir (outpath, " inf" , " previews" )
110- @test isdir (outpath, " inf" , " stable" )
111- @test isfile (outpath, " inf" , " stable" , " index.html" )
136+ if Sys. iswindows ()
137+ # On Windows, symlinks are either kept as simple files, or are in fact
138+ # symlinks, but then you would run into permission errors with isdir().
139+ # So we need to have platform-specific test logic here.
140+ path = joinpath (outpath, " inf" , " stable" )
141+ @test islink (path) || isfile (path)
142+ else
143+ @test isdir (outpath, " inf" , " stable" )
144+ @test isfile (outpath, " inf" , " stable" , " index.html" )
145+ end
112146
113147 @test read (joinpath (outpath, " inf" , " index.html" ), String) == """
114148 <!--This file is automatically generated by Documenter.jl-->
@@ -122,8 +156,7 @@ MultiDocumenter.make(
122156
123157
124158 @testset " custom scripts" begin
125- index = read (joinpath (outpath, " inf" , " stable" , " index.html" ), String)
126-
159+ index = read (joinpath (outpath, " inf" , " v1.6.4" , " index.html" ), String)
127160 @test occursin (
128161 """ <script charset="utf-8" type="text/javascript">window.MULTIDOCUMENTER_ROOT_PATH = '$rootpath '</script>""" ,
129162 index,
@@ -140,12 +173,36 @@ MultiDocumenter.make(
140173 """ <script charset="utf-8" type="text/javascript">const foo = 'bar';</script>""" ,
141174 index,
142175 )
176+
177+ if ! Sys. iswindows ()
178+ # Going through symlinks does not work on Windows
179+ index = read (joinpath (outpath, " inf" , " stable" , " index.html" ), String)
180+ @test occursin (
181+ """ <script charset="utf-8" type="text/javascript">window.MULTIDOCUMENTER_ROOT_PATH = '$rootpath '</script>""" ,
182+ index,
183+ )
184+ @test occursin (
185+ """ <script charset="utf-8" src="../../foo/bar.js" type="text/javascript"></script>""" ,
186+ index,
187+ )
188+ @test occursin (
189+ """ <script charset="utf-8" src="https://foo.com/bar.js" type="text/javascript"></script>""" ,
190+ index,
191+ )
192+ @test occursin (
193+ """ <script charset="utf-8" type="text/javascript">const foo = 'bar';</script>""" ,
194+ index,
195+ )
196+ end
143197 end
144198
145199 @testset " canonical URLs" begin
146- index = read (joinpath (outpath, " inf" , " stable" , " index.html" ), String)
147- canonical_href = " <link href=\" https://example.org/MultiDocumenter.jl/inf/stable/\" rel=\" canonical\" />"
148- @test occursin (canonical_href, index)
200+ # We can't traverse symlinks on Windows, so we ignore this case
201+ if ! Sys. iswindows ()
202+ index = read (joinpath (outpath, " inf" , " stable" , " index.html" ), String)
203+ canonical_href = " <link href=\" https://example.org/MultiDocumenter.jl/inf/stable/\" rel=\" canonical\" />"
204+ @test occursin (canonical_href, index)
205+ end
149206
150207 index = read (joinpath (outpath, " inf" , " v1.6.0" , " index.html" ), String)
151208 canonical_href = " <link href=\" https://example.org/MultiDocumenter.jl/inf/stable/\" rel=\" canonical\" />"
@@ -158,9 +215,17 @@ MultiDocumenter.make(
158215 @test ! isempty (store_content)
159216 @test occursin (" Infiltrator.jl" , store_content)
160217 @test occursin (" @infiltrate" , store_content)
161- @test occursin (" $(rootpath) inf/stable/" , store_content)
162- @test occursin (" $(rootpath) inf/stable/" , store_content)
163- @test ! occursin (" /inf/dev/" , store_content)
218+ # We can't traverse symlinks on Windows, so stable/ things do not get
219+ # written into the search index. Instead, it looks like we write dev/
220+ if Sys. iswindows ()
221+ @test ! occursin (" $(rootpath) inf/stable/" , store_content)
222+ @test ! occursin (" $(rootpath) inf/stable/" , store_content)
223+ @test occursin (" /inf/dev/" , store_content)
224+ else
225+ @test occursin (" $(rootpath) inf/stable/" , store_content)
226+ @test occursin (" $(rootpath) inf/stable/" , store_content)
227+ @test ! occursin (" /inf/dev/" , store_content)
228+ end
164229 end
165230
166231 @testset " sitemap" begin
0 commit comments