summaryrefslogtreecommitdiff
path: root/indra/llcommon/tests
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2022-12-20 09:48:36 -0500
committerNat Goodspeed <nat@lindenlab.com>2023-07-13 12:34:31 -0400
commit8855a82f512286bce6bd131d87dcafd303f2a5f6 (patch)
treec489e0eb8494edb59b035c9f3bdae66aff056937 /indra/llcommon/tests
parent196e49c1f8bd58ab9ce81843c10d452284ca7569 (diff)
DRTVWR-558: Add LL::apply() test for function(const LLSD&).
(cherry picked from commit 7d33e00d925614911a7602da1bd79916cc849ad7)
Diffstat (limited to 'indra/llcommon/tests')
-rw-r--r--indra/llcommon/tests/apply_test.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/indra/llcommon/tests/apply_test.cpp b/indra/llcommon/tests/apply_test.cpp
index 28ee3f9c81..9a17afc18c 100644
--- a/indra/llcommon/tests/apply_test.cpp
+++ b/indra/llcommon/tests/apply_test.cpp
@@ -108,6 +108,12 @@ namespace tut
ensure_equals("i4 mismatch", i4, statics::fibs[4]);
}
+ void sdfunc(const LLSD& sd)
+ {
+ called = true;
+ ensure_equals("sd mismatch", sd.asInteger(), statics::i);
+ }
+
void intfunc(int i)
{
called = true;
@@ -186,14 +192,24 @@ namespace tut
template<> template<>
void object::test<5>()
{
- set_test_name("apply(LLSD scalar)");
+ set_test_name("apply(fn(int), LLSD scalar)");
LL::apply(statics::intfunc, LLSD(statics::i));
- ensure("apply(LLSD scalar) failed", statics::called);
+ ensure("apply(fn(int), LLSD scalar) failed", statics::called);
}
template<> template<>
void object::test<6>()
{
+ set_test_name("apply(fn(LLSD), LLSD scalar)");
+ // This test verifies that LLSDParam<LLSD> doesn't send the compiler
+ // into infinite recursion when the target is itself LLSD.
+ LL::apply(statics::sdfunc, LLSD(statics::i));
+ ensure("apply(fn(LLSD), LLSD scalar) failed", statics::called);
+ }
+
+ template<> template<>
+ void object::test<7>()
+ {
set_test_name("apply(LLSD array)");
LL::apply(statics::various,
llsd::array(statics::b, statics::i, statics::f, statics::s,
@@ -202,7 +218,7 @@ namespace tut
}
template<> template<>
- void object::test<7>()
+ void object::test<8>()
{
set_test_name("VAPPLY()");
// Make a std::array<std::string> from statics::quick. We can't call a