Skip to content

Commit 4a383e8

Browse files
committed
Fix tests on <1.11
1 parent 091991b commit 4a383e8

File tree

3 files changed

+9
-23
lines changed

3 files changed

+9
-23
lines changed

src/Supposition.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ using Logging
1212

1313
using RequiredInterfaces: @required
1414

15-
@static if VERSION < v"1.11"
16-
using ScopedValues
17-
end
15+
using ScopedValues
1816

1917
include("types.jl")
2018
include("testcase.jl")

src/api.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ function final_check_block(namestr, run_input, gen_input, tsargs)
271271
res
272272
end
273273
n_tc = $Supposition.for_choices(choices, copy($ts.rng))
274-
obj = @with $Supposition.CURRENT_TESTCASE => n_tc begin
274+
obj = $ScopedValues.@with $Supposition.CURRENT_TESTCASE => n_tc begin
275275
$gen_input(n_tc)
276276
end
277277
@debug "Recording result in testset"

test/runtests.jl

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ const verb = VERSION.major == 1 && VERSION.minor < 11
390390
@test res isa Supposition.Error
391391
@test res.example == (i = -5,)
392392
@test res.exception == ErrorException("")
393-
@test length(res.trace) == 2
393+
@test 2 <= length(res.trace) <= 4
394394
@test res.trace[1].func == :error
395395
@test res.trace[2].func == :baba
396396
end
@@ -602,12 +602,8 @@ const verb = VERSION.major == 1 && VERSION.minor < 11
602602

603603
@check max_examples=3 record=false genRand(intgen, Data.just(data_rng_1), Data.just(default_rng_1))
604604
@check max_examples=3 record=false genRand(intgen, Data.just(data_rng_2), Data.just(default_rng_2))
605-
@testset let One=data_rng_1, Two=data_rng_2
606-
@test all(splat(!=), zip(data_rng_1, data_rng_2))
607-
end
608-
@testset let One=default_rng_1, Two=default_rng_2
609-
@test all(splat(!=), zip(default_rng_1, default_rng_2))
610-
end
605+
@test all(Base.splat(!=), zip(data_rng_1, data_rng_2))
606+
@test all(Base.splat(!=), zip(default_rng_1, default_rng_2))
611607

612608
# For the runs where we DO have an identical RNG the two runs should be identical,
613609
# even if the parent RNG is modified inbetween or tasks are spawned that may or
@@ -622,12 +618,8 @@ const verb = VERSION.major == 1 && VERSION.minor < 11
622618
fetch(@spawn(rand(UInt)))
623619
@check max_examples=3 record=false rng=Xoshiro(1) genRand(intgen, Data.just(data_rng_4), Data.just(default_rng_4))
624620

625-
@testset let One=data_rng_3, Two=data_rng_4
626-
@test all(splat(==), zip(data_rng_3, data_rng_4))
627-
end
628-
@testset let One=default_rng_3, Two=default_rng_4
629-
@test all(splat(==), zip(default_rng_3, default_rng_4))
630-
end
621+
@test all(Base.splat(==), zip(data_rng_3, data_rng_4))
622+
@test all(Base.splat(==), zip(default_rng_3, default_rng_4))
631623

632624
# Finally, we need to make sure that these invariants also hold when
633625
# replaying a stored counterexample from a DB
@@ -648,11 +640,7 @@ const verb = VERSION.major == 1 && VERSION.minor < 11
648640
rand(UInt)
649641
fetch(@spawn(rand(UInt)))
650642
@check broken=true db=db max_examples=1 record=false randFail(intgen, Data.just(data_rng_6), Data.just(default_rng_6))
651-
@testset let One=data_rng_5, Two=data_rng_6
652-
@test data_rng_5[] == data_rng_6[]
653-
end
654-
@testset let One=default_rng_5, Two=default_rng_6
655-
@test default_rng_5[] == default_rng_6[]
656-
end
643+
@test data_rng_5[] == data_rng_6[]
644+
@test default_rng_5[] == default_rng_6[]
657645
end
658646
end

0 commit comments

Comments
 (0)