Refine json object test for NDEBUG case

This commit is contained in:
Mike Ellery
2018-08-13 11:51:35 -07:00
committed by Nik Bougalis
parent b2f2d89a08
commit 5741a8356f

View File

@@ -209,13 +209,17 @@ public:
void testKeyFailure ()
{
#ifdef DEBUG
setup ("repeating keys");
auto& root = makeRoot();
root.set ("foo", "bar");
root.set ("baz", 0);
auto fail = [&]() { root.set ("foo", "bar"); };
expectException (fail);
// setting key again throws in !NDEBUG builds
auto set_again = [&]() { root.set ("foo", "bar"); };
#ifdef NDEBUG
set_again();
pass();
#else
expectException (set_again);
#endif
}