From eb44872310aaee737b4849523c5f73b3d5acce2d Mon Sep 17 00:00:00 2001 From: WooKyoung Noh Date: Sat, 21 May 2022 16:17:16 +0900 Subject: [PATCH] compat_default_testset --- src/runtests_testset.jl | 16 +++++++++++++++- test/test/testset.jl | 32 +++++++++++++++----------------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/runtests_testset.jl b/src/runtests_testset.jl index f3771cb..413f5da 100644 --- a/src/runtests_testset.jl +++ b/src/runtests_testset.jl @@ -4,6 +4,20 @@ using .Test: AbstractTestSet, DefaultTestSet +function compat_default_testset(args...; kwargs...)::DefaultTestSet + if VERSION < v"1.9.0-DEV.623" + ignore_keys = Vector{Symbol}() + push!(ignore_keys, :failfast) + if VERSION < v"1.6.0-DEV.1437" + push!(ignore_keys, :verbose) + end + filtered_kwargs = filter(kv -> !(first(kv) in ignore_keys), kwargs) + DefaultTestSet(args...; filtered_kwargs...) + else + DefaultTestSet(args...; kwargs...) + end +end + mutable struct JiveTestSet <: AbstractTestSet compile_time_start::UInt64 recompile_time_start::UInt64 @@ -13,7 +27,7 @@ mutable struct JiveTestSet <: AbstractTestSet elapsed_time::UInt64 default::DefaultTestSet function JiveTestSet(args...; kwargs...) - new(UInt64(0), UInt64(0), UInt64(0), UInt64(0), UInt64(0), UInt64(0), DefaultTestSet(args...; kwargs...)) + new(UInt64(0), UInt64(0), UInt64(0), UInt64(0), UInt64(0), UInt64(0), compat_default_testset(args...; kwargs...)) end end diff --git a/test/test/testset.jl b/test/test/testset.jl index 2d3bdd2..d02216c 100644 --- a/test/test/testset.jl +++ b/test/test/testset.jl @@ -1,18 +1,28 @@ +# julia 1.6.0-DEV.1437 commit 68c71f577275a16fffb743b2058afdc2d635068f module test_testset_verbose using Test -if VERSION >= v"1.6.0-DEV.1437" - @testset "Verbose 1" verbose = true begin - @testset "Verbose 2" begin - @test true - end +@testset "Verbose 1" verbose = true begin + @testset "Verbose 2" begin + @test true end end end # module test_testset_verbose +# julia 1.9.0-DEV.623 commit 88def1afe16acdfe41b15dc956742359d837ce04 +module test_testset_failfast + +using Test + +@testset failfast = true begin + @test true +end + +end # module test_testset_failfast + using Jive @If VERSION >= v"1.8.0-DEV.809" module test_testset_42518 @@ -31,15 +41,3 @@ end @testset bar(2) end # module test_testset_42518 - - -module test_testset_failfast - -using Test - -# julia 1.9.0-DEV.623 commit 88def1afe16acdfe41b15dc956742359d837ce04 -@testset failfast = true begin - @test true -end - -end # module test_testset_failfast