-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Fix make test-Test
#38406
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
Merged
Merged
Fix make test-Test
#38406
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
mutable struct NoThrowTestSet <: Test.AbstractTestSet | ||
results::Vector | ||
NoThrowTestSet(desc) = new([]) | ||
end | ||
Test.record(ts::NoThrowTestSet, t::Test.Result) = (push!(ts.results, t); t) | ||
Test.finish(ts::NoThrowTestSet) = ts.results |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -79,12 +79,8 @@ end | |||||
"Thrown: ErrorException") | ||||||
end | ||||||
# Test printing of Fail results | ||||||
mutable struct NoThrowTestSet <: Test.AbstractTestSet | ||||||
results::Vector | ||||||
NoThrowTestSet(desc) = new([]) | ||||||
end | ||||||
Test.record(ts::NoThrowTestSet, t::Test.Result) = (push!(ts.results, t); t) | ||||||
Test.finish(ts::NoThrowTestSet) = ts.results | ||||||
include("nothrow_testset.jl") | ||||||
|
||||||
let fails = @testset NoThrowTestSet begin | ||||||
# 1 - Fail - wrong exception | ||||||
@test_throws OverflowError error() | ||||||
|
@@ -797,29 +793,30 @@ end | |||||
@test startswith(fails[4].value, "ErrorException") | ||||||
end | ||||||
|
||||||
function newfunc() | ||||||
42 | ||||||
end | ||||||
@deprecate oldfunc newfunc | ||||||
let code = quote | ||||||
function newfunc() | ||||||
42 | ||||||
end | ||||||
@deprecate oldfunc newfunc | ||||||
|
||||||
@testset "@test_deprecated" begin | ||||||
@test_deprecated oldfunc() | ||||||
@testset "@test_deprecated" begin | ||||||
@test_deprecated oldfunc() | ||||||
@test Base.JLOptions().depwarn == 1 | ||||||
|
||||||
# Expression passthrough | ||||||
if Base.JLOptions().depwarn != 2 | ||||||
@test (@test_deprecated oldfunc()) == 42 | ||||||
@test (@test_deprecated oldfunc()) == 42 | ||||||
|
||||||
fails = @testset NoThrowTestSet "check that @test_deprecated detects bad input" begin | ||||||
@test_deprecated newfunc() | ||||||
@test_deprecated r"Not found in message" oldfunc() | ||||||
fails = @testset NoThrowTestSet "check that @test_deprecated detects bad input" begin | ||||||
@test_deprecated newfunc() | ||||||
@test_deprecated r"Not found in message" oldfunc() | ||||||
end | ||||||
@test length(fails) == 2 | ||||||
@test fails[1] isa Test.LogTestFailure | ||||||
@test fails[2] isa Test.LogTestFailure | ||||||
end | ||||||
@test length(fails) == 2 | ||||||
@test fails[1] isa Test.LogTestFailure | ||||||
@test fails[2] isa Test.LogTestFailure | ||||||
else | ||||||
@warn """Omitting `@test_deprecated` tests which can't yet | ||||||
be tested in --depwarn=error mode""" | ||||||
end | ||||||
incl = "include($(repr(joinpath(@__DIR__, "nothrow_testset.jl"))))" | ||||||
cmd = `$(Base.julia_cmd()) --startup-file=no --depwarn=yes -e 'using Test' -e $incl -e $code` | ||||||
@test success(pipeline(cmd)) | ||||||
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. Does
Suggested change
|
||||||
end | ||||||
|
||||||
@testset "@testset preserves GLOBAL_RNG's state, and re-seeds it" begin | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The fact that
-e $code
works in backticks and is completely safe... 😍(Yes, I've been bash scripting today)
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.
I think it can often still be a bit more reliable to put the content into stdin (via pipeline below). But the maximum here is
getconf ARG_MAX
, or 2MB on linux, 256KB on most posix, and 32k on Windows, and we're very well inside those limits here.