|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r83644 - trunk/libs/conversion/test
From: antoshkka_at_[hidden]
Date: 2013-03-30 03:41:24
Author: apolukhin
Date: 2013-03-30 03:41:23 EDT (Sat, 30 Mar 2013)
New Revision: 83644
URL: http://svn.boost.org/trac/boost/changeset/83644
Log:
Add tests for filesystem::path conversion (refs #7704)
Added:
trunk/libs/conversion/test/lexical_cast_filesystem_test.cpp (contents, props changed)
Text files modified:
trunk/libs/conversion/test/Jamfile.v2 | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
Modified: trunk/libs/conversion/test/Jamfile.v2
==============================================================================
--- trunk/libs/conversion/test/Jamfile.v2 (original)
+++ trunk/libs/conversion/test/Jamfile.v2 2013-03-30 03:41:23 EDT (Sat, 30 Mar 2013)
@@ -56,5 +56,6 @@
[ run lexical_cast_stream_detection_test.cpp ]
[ run lexical_cast_stream_traits_test.cpp ]
[ compile-fail lexical_cast_to_pointer_test.cpp ]
+ [ run lexical_cast_filesystem_test.cpp ../../filesystem/build//boost_filesystem/<link>static ]
;
Added: trunk/libs/conversion/test/lexical_cast_filesystem_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/conversion/test/lexical_cast_filesystem_test.cpp 2013-03-30 03:41:23 EDT (Sat, 30 Mar 2013)
@@ -0,0 +1,46 @@
+// Unit test for boost::lexical_cast.
+//
+// See http://www.boost.org for most recent version, including documentation.
+//
+// Copyright Antony Polukhin, 2013.
+//
+// Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).
+//
+// Test lexical_cast usage with long filesystem::path. Bug 7704.
+
+#include <boost/config.hpp>
+
+#include <boost/test/unit_test.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/filesystem/path.hpp>
+
+using namespace boost;
+
+void test_filesystem();
+
+unit_test::test_suite *init_unit_test_suite(int, char *[])
+{
+ unit_test::test_suite *suite =
+ BOOST_TEST_SUITE("lexical_cast unit test");
+ suite->add(BOOST_TEST_CASE(&test_filesystem));
+
+ return suite;
+}
+
+void test_filesystem()
+{
+ boost::filesystem::path p;
+ std::string s1 = "aaaaaaaaaaaaaaaaaaaaaaa";
+ p = boost::lexical_cast<boost::filesystem::path>(s1);
+ BOOST_CHECK(!p.empty());
+ BOOST_CHECK_EQUAL(p, s1);
+ p.clear();
+
+ const char ab[] = "aaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
+ p = boost::lexical_cast<boost::filesystem::path>(ab);
+ BOOST_CHECK(!p.empty());
+ BOOST_CHECK_EQUAL(p, ab);
+}
+
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk