From f4f3791a5ff1cc76b9d1054c269e69d44cdaf8d6 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Sun, 6 Feb 2011 11:57:19 -0500
Subject: Add test verifying passing LLSD() to const char* parameter.
 LLSDParam<const char*> is coded to pass NULL for an isUndefined() LLSD value,
 so event-based caller can choose whether to pass NULL, "" or whatever string
 value to such a parameter. Ensure this behavior.

---
 indra/llcommon/tests/lleventdispatcher_test.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

(limited to 'indra/llcommon')

diff --git a/indra/llcommon/tests/lleventdispatcher_test.cpp b/indra/llcommon/tests/lleventdispatcher_test.cpp
index 30d3c42554..bdd8c16cec 100644
--- a/indra/llcommon/tests/lleventdispatcher_test.cpp
+++ b/indra/llcommon/tests/lleventdispatcher_test.cpp
@@ -1229,4 +1229,18 @@ namespace tut
             }
         }
     }
+
+    template<> template<>
+    void object::test<21>()
+    {
+        set_test_name("verify that passing LLSD() to const char* sends NULL");
+
+        ensure_equals("Vars::cp init", v.cp, "");
+        work("methodna_map_mdft", LLSDMap("cp", LLSD()));
+        ensure_equals("passing LLSD()", v.cp, "NULL");
+        work("methodna_map_mdft", LLSDMap("cp", ""));
+        ensure_equals("passing \"\"", v.cp, "''");
+        work("methodna_map_mdft", LLSDMap("cp", "non-NULL"));
+        ensure_equals("passing \"non-NULL\"", v.cp, "'non-NULL'");
+    }
 } // namespace tut
-- 
cgit v1.2.3