Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Atteneder <[email protected]>
  • Loading branch information
fatteneder committed Oct 17, 2024
1 parent 877dc8c commit d3cb661
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2621,7 +2621,7 @@ for f in (:Any, :Function, :(Core.Builtin), :(Union{Nothing, Type}), :(Union{typ
@test_throws ErrorException("Method dispatch is unimplemented currently for this method signature") @eval (::$f)() = 1
end
for f in (:(Core.getfield), :((::typeof(Core.getfield))), :((::Core.IntrinsicFunction)))
@test_throws ErrorException("cannot add methods to a builtin function") @eval $f() = 1
@test_throws ErrorException("cannot add methods to or modify methods of a frozen function") @eval $f() = 1
end

# issue #33370
Expand Down
16 changes: 8 additions & 8 deletions test/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1299,14 +1299,14 @@ end

@test methods(Union{}) == Any[m.method for m in Base._methods_by_ftype(Tuple{Core.TypeofBottom, Vararg}, 1, Base.get_world_counter())] # issue #55187

# sealing
f_sealed(x::Int64) = x+1
Base.freeze!(Base.methods(f_sealed).mt)
# freezing Core.MethodTable
f_frozen(x::Int) = x+1
Base.freeze!(Base.methods(f_frozen).mt)
@test_throws(
ErrorException("cannot add methods to or modify methods of a frozen function"),
@eval f_sealed(x::Float64) = x+2
@eval f_frozen(x::Float64) = x+2
)
Base.unfreeze!(Base.methods(f_sealed).mt)
f_sealed(x::Float64) = x + 2
@test f_sealed(1) == 2
@test f_sealed(1.0) == 2.0
Base.unfreeze!(Base.methods(f_frozen).mt)
f_frozen(x::Float64) = x+2
@test f_frozen(1) == 2
@test f_frozen(1.0) == 3.0

0 comments on commit d3cb661

Please sign in to comment.