1
1
using SymbolServer, Pkg
2
2
using SymbolServer: packagename, packageuuid, deps, manifest, project, version, Package, frommanifest, VarRef, _lookup
3
- using Base: UUID
3
+ using Base: UUID
4
4
using Test
5
5
6
6
allns = SymbolServer. getallns ()
141
141
@test length (readdir (store_path)) == 0
142
142
end
143
143
144
+ if VERSION >= v " 1.6"
145
+ # The test-case uses a Manifest format that is incompatible with older versions of
146
+ # Julia.
147
+ @testset " issues/285" begin
148
+ mktempdir () do path
149
+ cp (joinpath (@__DIR__ , " testenv2" ), path; force= true )
150
+
151
+ project_path = joinpath (path, " proj" )
152
+
153
+ store_path = joinpath (path, " store" )
154
+ mkpath (store_path)
155
+
156
+ jl_cmd = joinpath (Sys. BINDIR, Base. julia_exename ())
157
+ withenv (" JULIA_PKG_PRECOMPILE_AUTO" => 0 ) do
158
+ run (` $jl_cmd --project=$project_path --startup-file=no -e 'using Pkg; Pkg.instantiate()'` )
159
+ end
160
+
161
+ ssi = SymbolServerInstance (" " , store_path)
162
+ ret_status, store = getstore (ssi, project_path; download= false )
163
+ @test ret_status == :success
164
+ @test length (store) == 4
165
+ @test haskey (store, :Core )
166
+ @test haskey (store, :Base )
167
+ @test haskey (store, :Main )
168
+ @test haskey (store, :A )
169
+
170
+ # Inspect the cached version, and check that the package SHA has been computed
171
+ # correctly.
172
+ cache_path = joinpath (store_path, " A" , " A_94f385dd-073b-49fe-b7ed-f824d09b3331" , " v0.1.0_nothing.jstore" )
173
+ @test isfile (cache_path)
174
+
175
+ cached_version = open (SymbolServer. CacheStore. read, cache_path)
176
+ @test ! isnothing (cached_version. sha)
177
+ @test cached_version. sha == SymbolServer. sha2_256_dir (joinpath (path, " A" , " src" ))
178
+
179
+ SymbolServer. clear_disc_store (ssi)
180
+ @test length (readdir (store_path)) == 0
181
+ end
182
+ end
183
+ end
184
+
144
185
@test SymbolServer. stdlibs[:Base ][:Sort ][:sort ] isa SymbolServer. FunctionStore
145
186
146
187
@testset " symbol documentation" begin
158
199
159
200
if VERSION >= v " 1.1-"
160
201
@testset " Excluding private packages from cache download requests" begin
161
- pkgs = Dict {Base.UUID, Pkg.Types.PackageEntry} ()
202
+ pkgs = Dict {Base.UUID,Pkg.Types.PackageEntry} ()
162
203
if VERSION < v " 1.3-"
163
204
pkgs[UUID (" 7876af07-990d-54b4-ab0e-23690620f79a" )] = Pkg. Types. PackageEntry (name= " Example" , other= Dict (" git-tree-sha1" => Base. SHA1 (" 0" ^ 40 )))
164
205
pkgs[UUID (" 3e13f8c9-a9aa-412e-8b2a-fda000b375e2" )] = Pkg. Types. PackageEntry (name= " NotInGeneral" , other= Dict (" git-tree-sha1" => Base. SHA1 (" 0" ^ 40 )))
188
229
using SymbolServer: FakeTypeName
189
230
190
231
@testset " TypeofVararg" begin
191
- Ts = Any[Vararg, Vararg{Bool,3 }, NTuple{N,Any} where N ]
232
+ Ts = Any[Vararg, Vararg{Bool,3 }, NTuple{N,Any} where {N} ]
192
233
isdefined (Core, :TypeofVararg ) && append! (Ts, Any[Vararg{Int}, Vararg{Rational}])
193
234
194
235
for ((i, T1), (j, T2)) in Iterators. product (enumerate .((Ts, Ts))... )
@@ -212,23 +253,26 @@ import UUIDs
212
253
else
213
254
tmp_access = try
214
255
n = " /tmp/" * string (UUIDs. uuid4 ())
215
- touch (n); rm (n)
256
+ touch (n)
257
+ rm (n)
216
258
true
217
259
catch
218
260
false
219
261
end
220
262
too_long = joinpath (tempdir (), string (UUIDs. uuid4 ())^ 3 )
221
263
mkdir (too_long)
222
- for TEMPDIR in (tempdir (), too_long); withenv (" TEMPDIR" => TEMPDIR) do
223
- p = SymbolServer. pipe_name ()
224
- # TEMPDIR + / + prefix + UUID[1:13]
225
- if length (tempdir ()) + 1 + length (" vscjlsymserv-" ) + 13 < 92 || ! tmp_access
226
- @test startswith (p, tempdir ())
227
- @test occursin (r" ^vscjlsymserv-\w {8}-\w {4}$" , basename (p))
228
- else
229
- @test occursin (r" ^/tmp/vscjlsymserv-\w {8}(?:-\w {4}){3}-\w {12}$" , p)
264
+ for TEMPDIR in (tempdir (), too_long)
265
+ withenv (" TEMPDIR" => TEMPDIR) do
266
+ p = SymbolServer. pipe_name ()
267
+ # TEMPDIR + / + prefix + UUID[1:13]
268
+ if length (tempdir ()) + 1 + length (" vscjlsymserv-" ) + 13 < 92 || ! tmp_access
269
+ @test startswith (p, tempdir ())
270
+ @test occursin (r" ^vscjlsymserv-\w {8}-\w {4}$" , basename (p))
271
+ else
272
+ @test occursin (r" ^/tmp/vscjlsymserv-\w {8}(?:-\w {4}){3}-\w {12}$" , p)
273
+ end
230
274
end
231
- end end
275
+ end
232
276
rm (too_long; recursive= true )
233
277
end
234
278
end
0 commit comments