diff options
Diffstat (limited to 'indra/llcommon/tests')
| -rwxr-xr-x | indra/llcommon/tests/llleap_test.cpp | 10 | ||||
| -rwxr-xr-x | indra/llcommon/tests/llsdserialize_test.cpp | 40 | 
2 files changed, 27 insertions, 23 deletions
diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 9ea822cb8d..653b043de4 100755 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -17,7 +17,7 @@  // std headers  // external library headers  #include <boost/assign/list_of.hpp> -#include <boost/lambda/lambda.hpp> +#include <boost/phoenix/core/argument.hpp>  #include <boost/foreach.hpp>  // other Linden headers  #include "../test/lltut.h" @@ -109,7 +109,7 @@ namespace tut          llleap_data():              reader(".py",                     // This logic is adapted from vita.viewerclient.receiveEvent() -                   boost::lambda::_1 << +                   boost::phoenix::placeholders::arg1 <<                     "import re\n"                     "import os\n"                     "import sys\n" @@ -403,7 +403,7 @@ namespace tut          AckAPI api;          Result result;          NamedTempFile script("py", -                             boost::lambda::_1 << +                             boost::phoenix::placeholders::arg1 <<                               "from " << reader_module << " import *\n"                               // make a request on our little API                               "request(pump='" << api.getName() << "', data={})\n" @@ -441,7 +441,7 @@ namespace tut          ReqIDAPI api;          Result result;          NamedTempFile script("py", -                             boost::lambda::_1 << +                             boost::phoenix::placeholders::arg1 <<                               "import sys\n"                               "from " << reader_module << " import *\n"                               // Note that since reader imports llsd, this @@ -484,7 +484,7 @@ namespace tut          ReqIDAPI api;          Result result;          NamedTempFile script("py", -                             boost::lambda::_1 << +                             boost::phoenix::placeholders::arg1 <<                               "import sys\n"                               "from " << reader_module << " import *\n"                               // Generate a very large string value. diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index b5893135ea..afd4e7c8c1 100755 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -46,9 +46,9 @@ typedef U32 uint32_t;  #include "boost/range.hpp"  #include "boost/foreach.hpp"  #include "boost/function.hpp" -#include "boost/lambda/lambda.hpp" -#include "boost/lambda/bind.hpp" -namespace lambda = boost::lambda; +#include "boost/phoenix/bind/bind_function.hpp" +#include "boost/phoenix/core/argument.hpp" +using namespace boost::phoenix;  #include "../llsd.h"  #include "../llsdserialize.h" @@ -1612,6 +1612,20 @@ namespace tut                 "print 'Running on', sys.platform\n");      } +    // helper for test<3> +    static void writeLLSDArray(std::ostream& out, const LLSD& array) +    { +        BOOST_FOREACH(LLSD item, llsd::inArray(array)) +        { +            LLSDSerialize::toNotation(item, out); +            // It's important to separate with newlines because Python's llsd +            // module doesn't support parsing from a file stream, only from a +            // string, so we have to know how much of the file to read into a +            // string. +            out << '\n'; +        } +    } +      template<> template<>      void TestPythonCompatibleObject::test<3>()      { @@ -1639,26 +1653,16 @@ namespace tut              "        assert False, 'Too many data items'\n";          // Create an llsdXXXXXX file containing 'data' serialized to -        // notation. It's important to separate with newlines because Python's -        // llsd module doesn't support parsing from a file stream, only from a -        // string, so we have to know how much of the file to read into a -        // string. +        // notation.          NamedTempFile file("llsd",                             // NamedTempFile's boost::function constructor                             // takes a callable. To this callable it passes the                             // std::ostream with which it's writing the -                           // NamedTempFile. This lambda-based expression -                           // first calls LLSD::Serialize() with that ostream, -                           // then streams a newline to it, etc. -                           (lambda::bind(LLSDSerialize::toNotation, cdata[0], lambda::_1), -                            lambda::_1 << '\n', -                            lambda::bind(LLSDSerialize::toNotation, cdata[1], lambda::_1), -                            lambda::_1 << '\n', -                            lambda::bind(LLSDSerialize::toNotation, cdata[2], lambda::_1), -                            lambda::_1 << '\n')); +                           // NamedTempFile. +                           bind(writeLLSDArray, placeholders::arg1, cdata));          python("read C++ notation", -               lambda::_1 << +               placeholders::arg1 <<                 import_llsd <<                 "def parse_each(iterable):\n"                 "    for item in iterable:\n" @@ -1679,7 +1683,7 @@ namespace tut          NamedTempFile file("llsd", "");          python("write Python notation", -               lambda::_1 << +               placeholders::arg1 <<                 "from __future__ import with_statement\n" <<                 import_llsd <<                 "DATA = [\n"  | 
