Skip to content

Commit 9515d4a

Browse files
committed
test setproperties error messages
1 parent 2a004c1 commit 9515d4a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

test/runtests.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,18 @@ end
2424
@test setproperties(o, (a=2, b=3.0)) === AB(2,3.0)
2525
@test setproperties(o, a=2, b=3.0) === AB(2,3.0)
2626

27-
@test_throws ArgumentError setproperties(o, (a=2, c=3.0))
28-
@test_throws ArgumentError setproperties(o, a=2, c=3.0)
27+
res = @test_throws ArgumentError setproperties(o, (a=2, this_field_does_not_exist=3.0))
28+
msg = sprint(showerror, res.value)
29+
@test occursin("this_field_does_not_exist", msg)
30+
@test occursin("overload", msg)
31+
@test occursin("ConstructionBase.setproperties", msg)
32+
33+
res = @test_throws ArgumentError setproperties(o, a=2, this_field_does_not_exist=3.0)
34+
msg = sprint(showerror, res.value)
35+
@test occursin("this_field_does_not_exist", msg)
36+
@test occursin("overload", msg)
37+
@test occursin("ConstructionBase.setproperties", msg)
38+
2939
@test setproperties(Empty(), NamedTuple()) === Empty()
3040
@test setproperties(Empty()) === Empty()
3141

0 commit comments

Comments
 (0)