From 8855a82f512286bce6bd131d87dcafd303f2a5f6 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 20 Dec 2022 09:48:36 -0500 Subject: DRTVWR-558: Add LL::apply() test for function(const LLSD&). (cherry picked from commit 7d33e00d925614911a7602da1bd79916cc849ad7) --- indra/llcommon/tests/apply_test.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'indra') 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,13 +192,23 @@ 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 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, @@ -202,7 +218,7 @@ namespace tut } template<> template<> - void object::test<7>() + void object::test<8>() { set_test_name("VAPPLY()"); // Make a std::array from statics::quick. We can't call a -- cgit v1.2.3