From 9515d4a2109bb954fed7b5da6a15275325901fb2 Mon Sep 17 00:00:00 2001 From: Jan Weidner Date: Thu, 3 Oct 2019 14:26:11 +0200 Subject: [PATCH] test setproperties error messages --- test/runtests.jl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 42e3dfb..24bc7bb 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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()