-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add test_warn macro to Base.Test for checking for warnings #19903
Changes from 14 commits
ee012bd
5103a1c
63c55d0
5ac63ab
fc2ece2
89257bd
ee53a54
6febcfa
0d8447a
f99c96a
d981d39
6ae2e67
3ca3209
3e7ca3a
28c208c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4822,6 +4822,17 @@ end | |
@test f14893() == 14893 | ||
@test M14893.f14893() == 14893 | ||
|
||
# issue #18725 | ||
@test_nowarn begin | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't tests run in a non-Main anonymous module now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Weird, right: the warning is getting output (correctly), but for some reason it is not captured by For example, if I do the following in
it outputs
(And yet, the other Any idea why the warning would not be captured here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I change the eval(current_module(), :(begin
f18725x(x) = 1
f18725x(x) = 2
@test f18725x(0) == 2
end))
end then it correctly captures the warning. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Somehow, it seems that the "Method definition overwritten" error is being printed at some other stage of code evaluation, so that it occurs before the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've pushed a workaround, and verified that it is not printing any warning that fails to get captured. (The issue of when the method-override warning gets printed seems unrelated to this PR.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (My workaround now evals the expression in |
||
f18725(x) = 1 | ||
f18725(x) = 2 | ||
@test f18725(0) == 2 | ||
end | ||
@test_warn "WARNING: Method definition f18725(Any) in module Module18725" eval(Main, :(module Module18725 | ||
f18725(x) = 1 | ||
f18725(x) = 2 | ||
end)) | ||
|
||
# issue #19599 | ||
f19599{T}(x::((S)->Vector{S})(T)...) = 1 | ||
@test f19599([1],[1]) == 1 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is now misleadingly ending a much-earlier trymisread, didn't see the
begin