Skip to content

Add test for a_method_to_overwrite_in_test #58769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8532,3 +8532,20 @@ primitive type ByteString58434 (18 * 8) end

@test Base.datatype_isbitsegal(Tuple{ByteString58434}) == false
@test Base.datatype_haspadding(Tuple{ByteString58434}) == (length(Base.padding(Tuple{ByteString58434})) > 0)

@testset "Tests for a_method_to_overwrite_in_test" begin
# Test the default method
result = a_method_to_overwrite_in_test()
@test result == 1

# Save original method by creating a backup
const old_func = a_method_to_overwrite_in_test

# Overwrite the method to return a different value
@eval Base a_method_to_overwrite_in_test() = 42
@test a_method_to_overwrite_in_test() == 42

# Restore the original method
@eval Base a_method_to_overwrite_in_test() = $(old_func())
@test a_method_to_overwrite_in_test() == 1
end