Skip to content

Commit d226632

Browse files
committed
refactor, add some tests, delete some unnecessary tests
1 parent e8207c7 commit d226632

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

test/no_invalidations.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ function test_expr(f, supertype::Type)
5151
end
5252

5353
@testset "no invalidations test set" begin
54+
concrete_subtypes_integer = (Bool, Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Int128, UInt128, BigInt)
55+
abstract_subtypes_number = (Signed, Unsigned, Integer, AbstractFloat, AbstractIrrational, Real, Number)
5456
@testset "2-arg `show` for various new types" begin
55-
stypes = (Integer, AbstractString, DenseVector{UInt8}, DenseMatrix{Float32}, AbstractUnitRange{Int})
56-
broken = (AbstractString,)
57+
stypes = (Any, AbstractString, Function, abstract_subtypes_number...)
58+
broken = (AbstractString, Function)
5759
@testset "S: $S" for S stypes
5860
@test test_expr((n -> :(function Base.show(::IO, ::$n) end)), S) broken=(S broken)
5961
end
@@ -71,24 +73,23 @@ end
7173
end
7274
end
7375
@testset "new subtype of `Integer`" begin
74-
int_types = (Bool, Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Int128, UInt128, BigInt)
7576
@testset "construction of old int type from new type" begin
7677
broken = (UInt16, Int, UInt)
7778
(Int === Int64) && (broken = (broken..., Int32))
78-
@testset "T: $T" for T int_types
79+
@testset "T: $T" for T concrete_subtypes_integer
7980
@test test_expr((n -> :(function Base.$T(::$n) end)), Integer) broken=(T broken)
8081
end
8182
end
8283
@testset "construction of new int type from old type" begin
8384
broken = ()
84-
@testset "T: $T" for T int_types
85+
@testset "T: $T" for T concrete_subtypes_integer
8586
@test test_expr((n -> :(function $n(::$T) end)), Integer) broken=(T broken)
8687
end
8788
end
8889
@testset "arithmetic between old int types and new int type" begin
8990
ops = (:+, :*, :<<, :>>, :>>>)
9091
broken = ()
91-
@testset "T: $T" for T int_types
92+
@testset "T: $T" for T concrete_subtypes_integer
9293
@testset "op: $op" for op ops
9394
@test (
9495
test_expr((n -> :(function Base.$op(::$n, ::$T) end)), Integer) &&
@@ -99,7 +100,7 @@ end
99100
end
100101
@testset "promotion between old int types and new int type" begin
101102
broken = (Bool, UInt8, Int)
102-
@testset "T: $T" for T int_types
103+
@testset "T: $T" for T concrete_subtypes_integer
103104
@test (
104105
test_expr((n -> :(function Base.promote_rule(::Type{$T}, ::Type{$n}) end)), Integer) &&
105106
test_expr((n -> :(function Base.promote_rule(::Type{$n}, ::Type{$T}) end)), Integer)

0 commit comments

Comments
 (0)