Skip to content

Commit

Permalink
Fix tests (#448)
Browse files Browse the repository at this point in the history
* Don't assume (io::IOBuffer).data is a Vector on new versions of Julia

* Exclude test/subtype.jl from corpus due to new dependence on where precedence (#395)
  • Loading branch information
LilithHafner committed Jul 2, 2024
1 parent a318134 commit 8fc81be
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/parse_stream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ function ParseStream(text::AbstractString, index::Integer=1; version=VERSION)
end

# IO-based cases
function ParseStream(io::IOBuffer; version=VERSION)
# TODO: switch ParseStream to use a Memory internally on newer versions of Julia
VERSION < v"1.11.0-DEV.753" && function ParseStream(io::IOBuffer; version=VERSION)
ParseStream(io.data, io, position(io)+1, version)
end
function ParseStream(io::Base.GenericIOBuffer; version=VERSION)
Expand Down
13 changes: 9 additions & 4 deletions test/parse_packages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ end
end

base_path = let
p = joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia", "base")
p = joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia", "base")
if !isdir(p)
# For julia 1.9 images.
p = joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia", "src", "base")
p = joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia", "src", "base")
if !isdir(p)
error("source for Julia base not found")
end
Expand All @@ -39,10 +39,10 @@ base_tests_path = joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia", "test")
return nothing
end

if endswith(f, "core.jl")
if endswith(f, "core.jl")
# The test
# @test Union{Tuple{T}, Tuple{T,Int}} where {T} === widen_diagonal(Union{Tuple{T}, Tuple{T,Int}} where {T})
# depends on a JuliaSyntax bugfix and parses differently (wrong) using
# depends on a JuliaSyntax bugfix and parses differently (wrong) using
# flisp. This was added in julia#52228 and backported in julia#52045
if v"1.10.0-rc1.39" <= VERSION
return nothing
Expand All @@ -52,6 +52,11 @@ base_tests_path = joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia", "test")
end
end

# subtype.jl also depends on the where precedence JuliaSyntax bugfix as of julia#53034
if endswith(f, "subtype.jl") && v"1.11.0-DEV.1382" <= VERSION
return nothing
end

return exprs_equal_no_linenum
end
end
Expand Down

0 comments on commit 8fc81be

Please sign in to comment.