summaryrefslogtreecommitdiff
path: root/indra/llcommon/tests/llsdserialize_test.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2023-08-17 09:53:01 -0400
committerNat Goodspeed <nat@lindenlab.com>2023-08-17 09:53:01 -0400
commit48759438b747c24b536cd099d65ab0c9ea720a38 (patch)
tree3bf3f883c575548e41f280d7565a23c12f44be3b /indra/llcommon/tests/llsdserialize_test.cpp
parent0f8b8fd7a338272e3464e809b94eb0443d99e275 (diff)
DRTVWR-588: Remove Boost Phoenix, Bind and Assign from some tests.
llsdserialize_test used Boost.Foreach, Boost.Function and Boost.Bind. llleap_test used Boost.Assign. Both used Boost.Phoenix. Replace Boost.Foreach with range 'for'. Replace Boost.Function with std::function. Replace Boost.Assign with initializer lists. Replace Boost.Bind and Boost.Phoenix with lambdas.
Diffstat (limited to 'indra/llcommon/tests/llsdserialize_test.cpp')
-rw-r--r--indra/llcommon/tests/llsdserialize_test.cpp39
1 files changed, 13 insertions, 26 deletions
diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp
index 5dbcf4c9b8..f46682e2d7 100644
--- a/indra/llcommon/tests/llsdserialize_test.cpp
+++ b/indra/llcommon/tests/llsdserialize_test.cpp
@@ -44,18 +44,10 @@ typedef U32 uint32_t;
#include "llstring.h"
#endif
-#include "boost/range.hpp"
-#include "boost/foreach.hpp"
-#include "boost/function.hpp"
-#include "boost/bind.hpp"
-#include "boost/phoenix/bind/bind_function.hpp"
-#include "boost/phoenix/core/argument.hpp"
-using namespace boost::phoenix;
-
-#include "../llsd.h"
-#include "../llsdserialize.h"
+#include "llsd.h"
+#include "llsdserialize.h"
#include "llsdutil.h"
-#include "../llformat.h"
+#include "llformat.h"
#include "../test/lltut.h"
#include "../test/namedtempfile.h"
@@ -1697,13 +1689,6 @@ namespace tut
struct TestPythonCompatible
{
TestPythonCompatible():
- // Note the peculiar insertion of __FILE__ into this string. Since
- // this script is being written into a platform-dependent temp
- // directory, we can't locate indra/lib/python relative to
- // Python's __file__. Use __FILE__ instead, navigating relative
- // to this C++ source file. Use Python raw-string syntax so
- // Windows pathname backslashes won't mislead Python's string
- // scanner.
import_llsd("import os.path\n"
"import sys\n"
"from llbase import llsd\n")
@@ -1801,7 +1786,7 @@ namespace tut
// helper for test<3>
static void writeLLSDArray(std::ostream& out, const LLSD& array)
{
- BOOST_FOREACH(LLSD item, llsd::inArray(array))
+ for (LLSD item: llsd::inArray(array))
{
LLSDSerialize::toNotation(item, out);
// It's important to separate with newlines because Python's llsd
@@ -1841,21 +1826,22 @@ namespace tut
// Create an llsdXXXXXX file containing 'data' serialized to
// notation.
NamedTempFile file("llsd",
- // NamedTempFile's boost::function constructor
+ // NamedTempFile's std::function constructor
// takes a callable. To this callable it passes the
// std::ostream with which it's writing the
// NamedTempFile.
- boost::bind(writeLLSDArray, _1, cdata));
+ [cdata](std::ostream& out){ writeLLSDArray(out, cdata); });
python("read C++ notation",
- placeholders::arg1 <<
+ [this, pydata, &file](std::ostream& out) {
+ out <<
import_llsd <<
"def parse_each(iterable):\n"
" for item in iterable:\n"
" yield llsd.parse(item)\n" <<
pydata <<
// Don't forget raw-string syntax for Windows pathnames.
- "verify(parse_each(open(r'" << file.getName() << "', 'rb')))\n");
+ "verify(parse_each(open(r'" << file.getName() << "', 'rb')))\n"; });
}
template<> template<>
@@ -1869,7 +1855,8 @@ namespace tut
NamedTempFile file("llsd", "");
python("write Python notation",
- placeholders::arg1 <<
+ [this, &file](std::ostream& out) {
+ out <<
import_llsd <<
"DATA = [\n"
" 17,\n"
@@ -1881,9 +1868,9 @@ namespace tut
"]\n"
// Don't forget raw-string syntax for Windows pathnames.
// N.B. Using 'print' implicitly adds newlines.
- "with open(r'" << file.getName() << "', 'w') as f:\n"
+ "with open(r'" << file.getName() << "', 'wb') as f:\n"
" for item in DATA:\n"
- " print(llsd.format_notation(item).decode(), file=f)\n");
+ " print(llsd.format_notation(item), file=f)\n"; });
std::ifstream inf(file.getName().c_str());
LLSD item;