Skip to content

Commit 3fcd7cf

Browse files
test: avoid segfault on 1.10
1 parent 45e5b14 commit 3fcd7cf

File tree

1 file changed

+24
-28
lines changed

1 file changed

+24
-28
lines changed

test/basics.jl

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -108,42 +108,38 @@ struct Ctx1 end
108108
struct Ctx2 end
109109

110110
# needs to be written like this to avoid a segfault on Julia 1.10
111-
@noinline function metadata_test()
112-
@syms a b c
113-
for a = [a, sin(a), a+b, a*b, a^3]
114-
115-
a′ = setmetadata(a, Ctx1, "meta_1")
111+
@info "Metadata test"
112+
@syms a b c
113+
for a = [a, sin(a), a+b, a*b, a^3]
116114

117-
@test hasmetadata(a′, Ctx1)
118-
@test !hasmetadata(a′, Ctx2)
115+
a′ = setmetadata(a, Ctx1, "meta_1")
119116

120-
a′ = setmetadata(a′, Ctx2, "meta_2")
117+
@test hasmetadata(a′, Ctx1)
118+
@test !hasmetadata(a′, Ctx2)
121119

122-
@test hasmetadata(a′, Ctx1)
123-
@test hasmetadata(a′, Ctx2)
120+
a′ = setmetadata(a′, Ctx2, "meta_2")
124121

125-
@test getmetadata(a′, Ctx1) == "meta_1"
126-
@test getmetadata(a′, Ctx2) == "meta_2"
127-
end
122+
@test hasmetadata(a′, Ctx1)
123+
@test hasmetadata(a′, Ctx2)
128124

129-
# In substitute #283
130-
#
131-
@syms f(t) t
132-
f = setmetadata(f(t), Ctx1, "yes")
133-
hasmetadata(f, Ctx1) # true
134-
newf = substitute(f, Dict(a=>b)) # unrelated substitution
135-
@test hasmetadata(newf, Ctx1)
136-
@test getmetadata(newf, Ctx1) == "yes"
125+
@test getmetadata(a′, Ctx1) == "meta_1"
126+
@test getmetadata(a′, Ctx2) == "meta_2"
127+
end
137128

129+
# In substitute #283
130+
#
131+
@syms f(t) t
132+
f = setmetadata(f(t), Ctx1, "yes")
133+
hasmetadata(f, Ctx1) # true
134+
newf = substitute(f, Dict(a=>b)) # unrelated substitution
135+
@test hasmetadata(newf, Ctx1)
136+
@test getmetadata(newf, Ctx1) == "yes"
138137

139-
@test isequal(substitute(1+sqrt(a), Dict(a => 2), fold=Val(false)),
140-
1 + term(sqrt, 2, type=Real))
141-
@test unwrap_const(substitute(1+sqrt(a), Dict(a => 2), fold=Val(true))) isa Float64
142-
end
143138

144-
@testset "metadata" begin
145-
metadata_test()
146-
end
139+
@test isequal(substitute(1+sqrt(a), Dict(a => 2), fold=Val(false)),
140+
1 + term(sqrt, 2, type=Real))
141+
@test unwrap_const(substitute(1+sqrt(a), Dict(a => 2), fold=Val(true))) isa Float64
142+
@info "Metadata test ends"
147143

148144
@testset "Base methods" begin
149145
@syms w::Complex{Real} z::Complex{Real} a::Real b::Real x

0 commit comments

Comments
 (0)