Skip to content

Commit

Permalink
test setproperties error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jw3126 committed Oct 3, 2019
1 parent 2a004c1 commit 9515d4a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,18 @@ end
@test setproperties(o, (a=2, b=3.0)) === AB(2,3.0)
@test setproperties(o, a=2, b=3.0) === AB(2,3.0)

@test_throws ArgumentError setproperties(o, (a=2, c=3.0))
@test_throws ArgumentError setproperties(o, a=2, c=3.0)
res = @test_throws ArgumentError setproperties(o, (a=2, this_field_does_not_exist=3.0))
msg = sprint(showerror, res.value)
@test occursin("this_field_does_not_exist", msg)
@test occursin("overload", msg)
@test occursin("ConstructionBase.setproperties", msg)

res = @test_throws ArgumentError setproperties(o, a=2, this_field_does_not_exist=3.0)
msg = sprint(showerror, res.value)
@test occursin("this_field_does_not_exist", msg)
@test occursin("overload", msg)
@test occursin("ConstructionBase.setproperties", msg)

@test setproperties(Empty(), NamedTuple()) === Empty()
@test setproperties(Empty()) === Empty()

Expand Down

0 comments on commit 9515d4a

Please sign in to comment.