From 63f81d59f6e736c5fdd30d8297d64d1677987d3c Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 2 Feb 2011 17:17:41 -0500 Subject: Add test to exercise map/array args mismatch validation. --- indra/llcommon/tests/lleventdispatcher_test.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/lleventdispatcher_test.cpp b/indra/llcommon/tests/lleventdispatcher_test.cpp index 30878beae4..2f2188a121 100644 --- a/indra/llcommon/tests/lleventdispatcher_test.cpp +++ b/indra/llcommon/tests/lleventdispatcher_test.cpp @@ -1056,4 +1056,24 @@ namespace tut ensure_equals("matching mismatch", ti->llsd, matching); } } + + template<> template<> + void object::test<17>() + { + set_test_name("passing wrong args to (map | array)-style registrations"); + + // Pass scalar/map to array-style functions, scalar/array to map-style + // functions. As that validation happens well before we engage the + // argument magic, it seems pointless to repeat this with every + // variation: (free function | non-static method), (no | arbitrary) + // args. We should only need to engage it for one map-style + // registration and one array-style registration. + std::string array_exc("needs an args array"); + call_exc("free0_array", 17, array_exc); + call_exc("free0_array", LLSDMap("pi", 3.14), array_exc); + + std::string map_exc("needs a map"); + call_exc("free0_map", 17, map_exc); + call_exc("free0_map", LLSDArray("a")("b"), map_exc); + } } // namespace tut -- cgit v1.2.3