Skip to content

Commit

Permalink
Merge pull request #784 from timholy/teh/fix_1.10
Browse files Browse the repository at this point in the history
Fix tests that were broken by 1.10
  • Loading branch information
timholy authored Dec 31, 2023
2 parents 4703784 + 6b74df8 commit 4803987
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
3 changes: 3 additions & 0 deletions test/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,6 @@ if !isempty(ARGS) && "REVISE_TESTS_WATCH_FILES" ∈ ARGS
idx = findall(isequal("REVISE_TESTS_WATCH_FILES"), ARGS)
deleteat!(ARGS, idx)
end

errmsg(err::Base.Meta.ParseError) = err.msg
errmsg(err::AbstractString) = err
4 changes: 2 additions & 2 deletions test/populate_compiled.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This runs only on Travis. The goal is to populate the `.julia/compiled/v*` directory
# This runs only on CI. The goal is to populate the `.julia/compiled/v*` directory
# with some additional files, so that `filter_valid_cachefiles` has to run.
# This is to catch problems like #460.

Expand All @@ -12,5 +12,5 @@ paths = Base.find_all_in_cache_path(id)
Pkg.rm("EponymTuples") # we don't need it anymore
path = first(paths)
base, ext = splitext(path)
mv(path, base*"blahblah"*ext)
mv(path, base*"blahblah"*ext; force=true)
Pkg.add(PackageSpec(name="EponymTuples"))
13 changes: 7 additions & 6 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const issue639report = []
catch err
@test isa(err, LoadError)
@test err.file == file
@test endswith(err.error, "requires end")
@test endswith(errmsg(err.error), Base.VERSION < v"1.10" ? "requires end" : "Expected `end`")
end
end

Expand Down Expand Up @@ -1979,15 +1979,15 @@ const issue639report = []
if ErrorType === LoadError
@test exc.file == fn
@test exc.line == line
@test occursin(msg, exc.error)
@test occursin(msg, errmsg(exc.error))
elseif ErrorType === UndefVarError
@test msg == exc.var
end
@test length(st) == 1
end

# test errors are reported the the first time
check_revision_error(logs[1], LoadError, "missing comma or }", 2)
check_revision_error(logs[1], LoadError, Base.VERSION < v"1.10" ? "missing comma or }" : "Expected `}`", 2 + (Base.VERSION >= v"1.10"))
# Check that there's an informative warning
rec = logs[2]
@test startswith(rec.message, "The running code does not match")
Expand All @@ -2003,7 +2003,7 @@ const issue639report = []
logs,_ = Test.collect_test_logs() do
Revise.errors()
end
check_revision_error(logs[1], LoadError, "missing comma or }", 2)
check_revision_error(logs[1], LoadError, Base.VERSION < v"1.10" ? "missing comma or }" : "Expected `}`", 2 + (Base.VERSION >= v"1.10"))

write(joinpath(dn, "RevisionErrors.jl"), """
module RevisionErrors
Expand Down Expand Up @@ -2033,7 +2033,8 @@ const issue639report = []
logs, _ = Test.collect_test_logs() do
yry()
end
check_revision_error(logs[1], LoadError, "unexpected \"=\"", 6)
delim = Base.VERSION < v"1.10" ? '"' : '`'
check_revision_error(logs[1], LoadError, "unexpected $delim=$delim", 6 + (Base.VERSION >= v"1.10")*2)

write(joinpath(dn, "RevisionErrors.jl"), """
module RevisionErrors
Expand Down Expand Up @@ -2079,7 +2080,7 @@ const issue639report = []
revise(throw=true)
false
catch err
isa(err, LoadError) && occursin("""unexpected "}" """, err.error)
isa(err, LoadError) && occursin(Base.VERSION < v"1.10" ? """unexpected "}" """ : "Expected `)`", errmsg(err.error))
end
sleep(mtimedelay)
write(joinpath(dn, "RevisionErrors.jl"), """
Expand Down
2 changes: 1 addition & 1 deletion test/sigtest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ end

basefiles = Set{String}()
@time for (i, (mod, file)) in enumerate(Base._included_files)
endswith(file, "sysimg.jl") && continue
(endswith(file, "sysimg.jl") || endswith(file, "Base.jl")) && continue
file = Revise.fixpath(file)
push!(basefiles, reljpath(file))
mexs = Revise.parse_source(file, mod)
Expand Down

0 comments on commit 4803987

Please sign in to comment.