diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2019-08-10 20:33:59 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2019-08-10 20:33:59 -0400 |
commit | adb3f447b33e42bdb6e4a5a1ac79eebd862dafb4 (patch) | |
tree | 707a9c35c7568782a7c7f968c6846b4646e84be3 /indra/llmessage/tests | |
parent | 8053bceaa0ccd6128536375c21cc3e9e19429efa (diff) |
DRTVWR-493: Introduce test catch_what(), catch_llerrs() functions.
Use them in place of awkward try/catch test boilerplate.
Diffstat (limited to 'indra/llmessage/tests')
-rw-r--r-- | indra/llmessage/tests/llareslistener_test.cpp | 48 |
1 files changed, 12 insertions, 36 deletions
diff --git a/indra/llmessage/tests/llareslistener_test.cpp b/indra/llmessage/tests/llareslistener_test.cpp index c04696c86b..8e5bcd326c 100644 --- a/indra/llmessage/tests/llareslistener_test.cpp +++ b/indra/llmessage/tests/llareslistener_test.cpp @@ -138,15 +138,9 @@ namespace tut WrapLLErrs capture; LLSD request; request["op"] = "foo"; - std::string threw; - try - { - LLEventPumps::instance().obtain("LLAres").post(request); - } - catch (const WrapLLErrs::FatalException& e) - { - threw = e.what(); - } + std::string threw = catch_llerrs([&request](){ + LLEventPumps::instance().obtain("LLAres").post(request); + }); ensure_contains("LLAresListener bad op", threw, "bad"); } @@ -157,15 +151,9 @@ namespace tut WrapLLErrs capture; LLSD request; request["op"] = "rewriteURI"; - std::string threw; - try - { - LLEventPumps::instance().obtain("LLAres").post(request); - } - catch (const WrapLLErrs::FatalException& e) - { - threw = e.what(); - } + std::string threw = catch_llerrs([&request](){ + LLEventPumps::instance().obtain("LLAres").post(request); + }); ensure_contains("LLAresListener bad req", threw, "missing"); ensure_contains("LLAresListener bad req", threw, "reply"); ensure_contains("LLAresListener bad req", threw, "uri"); @@ -179,15 +167,9 @@ namespace tut LLSD request; request["op"] = "rewriteURI"; request["reply"] = "nonexistent"; - std::string threw; - try - { - LLEventPumps::instance().obtain("LLAres").post(request); - } - catch (const WrapLLErrs::FatalException& e) - { - threw = e.what(); - } + std::string threw = catch_llerrs([&request](){ + LLEventPumps::instance().obtain("LLAres").post(request); + }); ensure_contains("LLAresListener bad req", threw, "missing"); ensure_contains("LLAresListener bad req", threw, "uri"); ensure_does_not_contain("LLAresListener bad req", threw, "reply"); @@ -201,15 +183,9 @@ namespace tut LLSD request; request["op"] = "rewriteURI"; request["uri"] = "foo.bar.com"; - std::string threw; - try - { - LLEventPumps::instance().obtain("LLAres").post(request); - } - catch (const WrapLLErrs::FatalException& e) - { - threw = e.what(); - } + std::string threw = catch_llerrs([&request](){ + LLEventPumps::instance().obtain("LLAres").post(request); + }); ensure_contains("LLAresListener bad req", threw, "missing"); ensure_contains("LLAresListener bad req", threw, "reply"); ensure_does_not_contain("LLAresListener bad req", threw, "uri"); |