summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2011-02-05 22:49:53 -0500
committerNat Goodspeed <nat@lindenlab.com>2011-02-05 22:49:53 -0500
commit934e8c39761bd4f4b7c04eb8b29e0a305182e4ed (patch)
tree81331784c3700ff0c8ff47c5e40c94d4599663ed /indra/llcommon
parent54b1db2f6587acd11254f30addd8c53e00e05518 (diff)
Make array-funcs success test exercise args-array-too-long case too.
Streamline a bit more redundancy from the code in that test.
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/tests/lleventdispatcher_test.cpp37
1 files changed, 26 insertions, 11 deletions
diff --git a/indra/llcommon/tests/lleventdispatcher_test.cpp b/indra/llcommon/tests/lleventdispatcher_test.cpp
index 32ba0cd16f..c31f037d7f 100644
--- a/indra/llcommon/tests/lleventdispatcher_test.cpp
+++ b/indra/llcommon/tests/lleventdispatcher_test.cpp
@@ -1186,19 +1186,34 @@ namespace tut
// Adjust expect["a"]["cp"] for special Vars::cp treatment.
expect["a"]["cp"] = std::string("'") + expect["a"]["cp"].asString() + "'";
cout << "expect: " << expect << '\n';
- foreach(const FunctionsTriple& tr, array_funcs(v))
- {
- *tr.vars = Vars();
- work(tr.name1, args["a"]);
- ensure_llsd(STRINGIZE(tr.name1 << ": expect[\"a\"] mismatch"),
- tr.vars->inspect(), expect["a"], 7); // 7 bits ~= 2 decimal digits
- *tr.vars = Vars();
- work(tr.name2, args["b"]);
- ensure_llsd(STRINGIZE(tr.name2 << ": expect[\"b\"] mismatch"),
- tr.vars->inspect(), expect["b"], 7);
+ // Use substantially the same logic for args and argsplus
+ LLSD argsarrays(LLSDArray(args)(argsplus));
+ // So i==0 selects 'args', i==1 selects argsplus
+ for (LLSD::Integer i(0), iend(argsarrays.size()); i < iend; ++i)
+ {
+ foreach(const FunctionsTriple& tr, array_funcs(v))
+ {
+ // Get tr.name1 and tr.name2 into a map keyed by ["a"] and ["b"]
+ LLSD funcs(LLSDMap("a", tr.name1)("b", tr.name2));
- // TODO: argsplus, check LL_WARNS output?
+ // So now we can call tr.name1 (as funcs["a"]) with the "a"
+ // params, etc.
+ foreach(LLSD::String a, ab)
+ {
+ // Reset the Vars instance before each call
+ *tr.vars = Vars();
+ work(funcs[a], argsarrays[i][a]);
+ ensure_llsd(STRINGIZE(funcs[a].asString() <<
+ ": expect[\"" << a << "\"] mismatch"),
+ tr.vars->inspect(), expect[a], 7); // 7 bits ~= 2 decimal digits
+
+ // TODO: in the i==1 or argsplus case, intercept LL_WARNS
+ // output? Even without that, using argsplus verifies that
+ // passing too many args isn't fatal; it works -- but
+ // would be nice to notice the warning too.
+ }
+ }
}
}