|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58330 - in sandbox/filesystem-v3: . boost boost/filesystem libs/filesystem/doc libs/filesystem/src libs/filesystem/test libs/filesystem/test/msvc/deprecated_test
From: bdawes_at_[hidden]
Date: 2009-12-12 17:35:45
Author: bemandawes
Date: 2009-12-12 17:35:43 EST (Sat, 12 Dec 2009)
New Revision: 58330
URL: http://svn.boost.org/trac/boost/changeset/58330
Log:
Misc fixes and additions in prep for alpha
Added:
sandbox/filesystem-v3/boost/filesystem.hpp (contents, props changed)
sandbox/filesystem-v3/install_distro.bat (contents, props changed)
sandbox/filesystem-v3/libs/filesystem/doc/v3.html (contents, props changed)
Text files modified:
sandbox/filesystem-v3/boost/filesystem/path.hpp | 15 +++++-
sandbox/filesystem-v3/create_distro.bat | 10 ++--
sandbox/filesystem-v3/libs/filesystem/doc/index.htm | 11 +++-
sandbox/filesystem-v3/libs/filesystem/doc/reference.html | 30 ++++++------
sandbox/filesystem-v3/libs/filesystem/src/operations.cpp | 9 ++-
sandbox/filesystem-v3/libs/filesystem/src/path.cpp | 22 ++++++---
sandbox/filesystem-v3/libs/filesystem/test/deprecated_test.cpp | 6 +-
sandbox/filesystem-v3/libs/filesystem/test/msvc/deprecated_test/deprecated_test.vcproj | 4 +
sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp | 6 +-
sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp | 87 +++++++++++++++++++++++++++------------
sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp | 2
11 files changed, 129 insertions(+), 73 deletions(-)
Added: sandbox/filesystem-v3/boost/filesystem.hpp
==============================================================================
--- (empty file)
+++ sandbox/filesystem-v3/boost/filesystem.hpp 2009-12-12 17:35:43 EST (Sat, 12 Dec 2009)
@@ -0,0 +1,20 @@
+// boost/filesystem/filesystem.hpp -----------------------------------------//
+
+// Copyright Beman Dawes 2005
+
+// Use, modification, and distribution is subject to 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)
+
+// See library home page at http://www.boost.org/libs/filesystem
+
+//----------------------------------------------------------------------------//
+
+#ifndef BOOST_FILESYSTEM_FILESYSTEM_HPP
+#define BOOST_FILESYSTEM_FILESYSTEM_HPP
+
+#include <boost/filesystem/operations.hpp> // includes path.hpp
+#include <boost/filesystem/convenience.hpp>
+
+#endif
+
Modified: sandbox/filesystem-v3/boost/filesystem/path.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/path.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/path.hpp 2009-12-12 17:35:43 EST (Sat, 12 Dec 2009)
@@ -1,6 +1,6 @@
// filesystem path.hpp ---------------------------------------------------------------//
-// Copyright Beman Dawes 2002-2005, 2008
+// Copyright Beman Dawes 2002-2005, 2009
// Copyright Vladimir Prus 2002
// Distributed under the Boost Software License, Version 1.0.
@@ -273,8 +273,8 @@
// ----- modifiers -----
- void clear() { m_path.clear(); }
- void swap(path& rhs) { m_path.swap(rhs.m_path); }
+ void clear() { m_path.clear(); }
+ void swap(path& rhs) { m_path.swap(rhs.m_path); }
path& remove_filename();
path& replace_extension(const path& new_extension = path());
@@ -445,6 +445,10 @@
//--------------------------------------------------------------------------------------//
private:
+# if defined(_MSC_VER)
+# pragma warning(push) // Save warning settings
+# pragma warning(disable : 4251) // disable warning: class 'std::basic_string<_Elem,_Traits,_Ax>'
+# endif // needs to have dll-interface...
/*
m_path has the type, encoding, and format required by the native
operating system. Thus for POSIX and Windows there is no conversion for
@@ -455,13 +459,16 @@
*/
string_type m_path; // Windows: as input; backslashes NOT converted to slashes,
// slashes NOT converted to backslashes
+# if defined(_MSC_VER)
+# pragma warning(pop) // restore warning settings.
+# endif
string_type::size_type m_append_separator_if_needed();
// Returns: If separator is to be appended, m_path.size() before append. Otherwise 0.
// Note: An append is never performed if size()==0, so a returned 0 is unambiguous.
void m_erase_redundant_separator(string_type::size_type sep_pos);
-
+ string_type::size_type m_parent_path_end() const;
void m_portable();
//path& m_normalize();
Modified: sandbox/filesystem-v3/create_distro.bat
==============================================================================
--- sandbox/filesystem-v3/create_distro.bat (original)
+++ sandbox/filesystem-v3/create_distro.bat 2009-12-12 17:35:43 EST (Sat, 12 Dec 2009)
@@ -1,31 +1,31 @@
+@echo off
rem Create Boost Filesystem Version 3 distribution for Windows
rem Copyright 2009 Beman Dawes
rem Distributed under the Boost Software License, Version 1.0.
rem See http://www.boost.org/LICENSE_1_0.txt
-_at_echo off
echo Create Boost Filesystem Version 3 distribution for Windows
if {%1}=={} goto usage
-echo Preparing temporary directory %TEMP%\%1...
+echo Prepare temporary directory %TEMP%\%1...
pushd %TEMP%
rmdir /S /Q %1 2>nul
del %1.zip 2>nul
-echo Exporting https://svn.boost.org/svn/boost/sandbox/filesystem-v3 to %TEMP%\%1...
+echo Exporte https://svn.boost.org/svn/boost/sandbox/filesystem-v3 to %TEMP%\%1...
svn export --non-interactive --trust-server-cert --native-eol CRLF ^
https://svn.boost.org/svn/boost/sandbox/filesystem-v3 %1
echo Creating %TEMP%\%1.zip...
zip -r -q %1.zip %1
-echo Finishing up...
+echo Finish up...
popd
dir %TEMP%\%1.zip
goto done
:usage
-echo Usage: create-distro distro-name
+echo Usage: create_distro distro-name
echo Will create %TEMP%\distro-name.zip
:done
Added: sandbox/filesystem-v3/install_distro.bat
==============================================================================
--- (empty file)
+++ sandbox/filesystem-v3/install_distro.bat 2009-12-12 17:35:43 EST (Sat, 12 Dec 2009)
@@ -0,0 +1,69 @@
+@echo off
+rem Install Boost Filesystem Version 3 distribution for Windows
+
+rem Copyright 2009 Beman Dawes
+rem Distributed under the Boost Software License, Version 1.0.
+rem See http://www.boost.org/LICENSE_1_0.txt
+
+echo Install Boost Filesystem Version 3 distribution for Windows
+if {%1}=={} goto usage
+if {%2}=={} goto usage
+
+if not exist %1 (
+ echo error: %1 not found
+ goto done
+)
+
+if not exist %2 (
+ echo error: %2 not found
+ goto done
+)
+
+if not exist %2\boost-build.jam (
+ echo error: %2 does not contain boost-build.jam
+ echo Is it really a Boost root directory?
+ goto done
+)
+
+pushd %2
+echo Delete prior version of Filesystem...
+del boost\filesystem.hpp
+rmdir /S /Q boost\filesystem
+rmdir /S /Q libs\filesystem
+
+if not exist bjam.exe (
+ echo Running bootstrap script...
+ bootstrap >bootstrap.log 2>&1
+ echo bootstrap complete - see %2\boostrap.log for details
+)
+
+echo Copy files from %1 to %2...
+xcopy /s /q C:\temp\filesystem-v3-alpha-0.1\* .
+
+echo Build libraries...
+time /t
+echo If other libraries have not been previously built, this step may take a
+echo long time - 10 minutes on a fast machine, much longer on a slow machine.
+.\bjam >bjam.log 2>&1
+time /t
+echo Build complete - see %2\bjam.log for details.
+echo Libraries have been installed in %2\stage
+
+echo Test Filesystem Version 3...
+pushd libs\filesystem\test
+time /t
+..\..\..\bjam >bjam.log 2>&1
+time /t
+popd
+find "...failed" libs\filesystem\test\bjam.log
+echo Test complete - see %2\libs\filesystem\test\bjam.log for details.
+
+echo Installation complete.
+popd
+goto done
+
+:usage
+echo Usage: install_distro distro-path boost-path
+echo Installs the Filesystem V3 distribution file found at distro-path
+echo in the Boost root found at boost-path
+:done
Modified: sandbox/filesystem-v3/libs/filesystem/doc/index.htm
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/doc/index.htm (original)
+++ sandbox/filesystem-v3/libs/filesystem/doc/index.htm 2009-12-12 17:35:43 EST (Sat, 12 Dec 2009)
@@ -24,9 +24,12 @@
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="100%">
<tr>
- <td>Boost Home
- Library Home Tutorial <a href="reference.html">
- Reference</a> FAQ</td>
+ <td>Boost Home
+ Library Home
+ Tutorial
+ Reference
+ FAQ
+ V3 Introduction</td>
</tr>
</table>
@@ -799,7 +802,7 @@
<hr>
<p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->01 September, 2009<!--webbot bot="Timestamp" endspan i-checksum="39345" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->12 December, 2009<!--webbot bot="Timestamp" endspan i-checksum="38514" --></p>
<p>© Copyright Beman Dawes, 2002-2005</p>
<p> Use, modification, and distribution are subject to the Boost Software
Modified: sandbox/filesystem-v3/libs/filesystem/doc/reference.html
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/doc/reference.html (original)
+++ sandbox/filesystem-v3/libs/filesystem/doc/reference.html 2009-12-12 17:35:43 EST (Sat, 12 Dec 2009)
@@ -26,10 +26,13 @@
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="100%">
<tr>
- <td>Boost Home
- Library Home
- Tutorial <a href="reference.html">
- Reference</a> FAQ</td>
+ <td>Boost Home
+ Library Home
+ Tutorial
+ Reference
+ FAQ
+ V3 Introduction
+ </td>
</tr>
</table>
@@ -320,8 +323,8 @@
void last_write_time(const path& p, const std::time_t new_time);
void last_write_time(const path& p, const std::time_t new_time, system::error_code& ec);
- path read_symlink(const path& p);
- path read_symlink(const path& p, system::error_code& ec);
+ path read_symlink(const path& p);
+ path read_symlink(const path& p, system::error_code& ec);
bool remove(const path& p);
bool remove(const path& p, system::error_code& ec);
@@ -821,13 +824,10 @@
</blockquote>
<pre>path& remove_filename();</pre>
<blockquote>
- <p><i>Effects:</i> If <code>has_parent_path()</code> then remove the last filename from the
- contained pathname. If that leaves
- the contained pathname with one or more trailing separator elements not
- representing a root-directory, remove them.</p>
- <p><i>Returns:</i> <code>*this</code></p>
+ <p><i>Returns: </i>As if, <code>*this = parent_path();</code></p>
<p>[<i>Note:</i> This function is needed to efficiently implement <code>
- directory_iterator</code>. It is made public to allow additional uses. <i>-- end
+ directory_iterator</code>. It is exposed to allow additional uses. The actual
+ implementation may be much more efficient than <code>*this = parent_path()</code> <i>-- end
note</i>]</p>
</blockquote>
<pre>path& replace_extension(const path& new_extension = path());</pre>
@@ -967,8 +967,8 @@
</blockquote>
<pre>path parent_path() const;</pre>
<blockquote>
- <p><i>Returns:</i> <code>(empty() || begin() == --end()) ? path() :
- <i>br</i></code>, where <code><i>br</i></code> is constructed as if by
+ <p><i>Returns:</i> <code>(empty() || begin() == --end()) ? path() : <i>pp</i></code>, where
+ <code><i>pp</i></code> is constructed as if by
starting with an empty <code>path</code> and successively applying <code>
operator/=</code> for each element in the range <code>begin()</code>, <code>
--end()</code>.</p>
@@ -3310,7 +3310,7 @@
<p>Distributed under the Boost Software License, Version 1.0. See
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
<p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->11 December 2009<!--webbot bot="Timestamp" endspan i-checksum="39735" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->12 December 2009<!--webbot bot="Timestamp" endspan i-checksum="39737" --></p>
</body>
Added: sandbox/filesystem-v3/libs/filesystem/doc/v3.html
==============================================================================
--- (empty file)
+++ sandbox/filesystem-v3/libs/filesystem/doc/v3.html 2009-12-12 17:35:43 EST (Sat, 12 Dec 2009)
@@ -0,0 +1,69 @@
+<html>
+
+<head>
+<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
+<meta name="ProgId" content="FrontPage.Editor.Document">
+<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
+<title>Boost.Filesystem Version 3</title>
+<link rel="stylesheet" type="text/css" href="../../../doc/html/minimal.css">
+
+<body>
+
+<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="933">
+ <tr>
+ <td width="277">
+<a href="../../../index.htm">
+<img src="../../../boost.png" alt="boost.png (6897 bytes)" align="middle" width="277" height="86" border="0"></a></td>
+ <td width="633" align="middle">
+ <font size="7">Filesystem Library<br>
+ Version 3<br>
+ </font></td>
+ </tr>
+</table>
+
+<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="100%">
+ <tr>
+ <td>Boost Home
+ Library Home
+ Tutorial <a href="reference.html">
+ Reference</a> FAQ</td>
+ </tr>
+</table>
+
+<h1>Boost Filesystem Version 3</h1>
+
+<p>Version 3 is a major revision of the Boost Filesystem library. Important
+changes include:</p>
+
+<ul>
+ <li>A single class <code>path</code> handles all aspects of
+ internationalization, replacing the previous template and its <code>path</code>
+ and <code>wpath</code> instantiations. Character types <code>char</code>,
+ <code>wchar_t</code>, <code>char16_t</code>, and <code>char32_t</code> are
+ supported. This is a major simplification of the path abstraction,
+ particularly for functions that take path arguments.<br>
+ </li>
+ <li>Support for error reporting via <code>error_code</code> is now uniform
+ throughout the library.<br>
+ </li>
+ <li>New or improved operational functions include:<br>
+ <ul>
+ <li><code>create_symlink()</code> now supported on both POSIX and Windows.</li>
+ <li><code>read_symlink()</code> function added. Supported on both POSIX and
+ Windows.</li>
+ <li><code>resize_file()</code> function added. Supported on both POSIX and
+ Windows.</li>
+ </ul>
+ </li>
+</ul>
+
+<hr>
+<p>© Copyright Beman Dawes, 2009</p>
+<p>Distributed under the Boost Software License, Version 1.0. See
+www.boost.org/LICENSE_1_0.txt</p>
+<p>Revised
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->12 December 2009<!--webbot bot="Timestamp" endspan i-checksum="39737" --></p>
+
+</body>
+
+</html>
\ No newline at end of file
Modified: sandbox/filesystem-v3/libs/filesystem/src/operations.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/src/operations.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/src/operations.cpp 2009-12-12 17:35:43 EST (Sat, 12 Dec 2009)
@@ -58,6 +58,7 @@
# if defined(BOOST_WINDOWS_API)
# include <windows.h>
+# include <winnt.h>
# if !defined(_WIN32_WINNT)
# define _WIN32_WINNT 0x0500
# endif
@@ -71,9 +72,10 @@
# endif
// REPARSE_DATA_BUFFER related definitions are found in ntifs.h, which is part of the
-// Windows Device Driver Kit. Since that's inconvient, the needed definitions are
-// provided here.
-// See http://msdn.microsoft.com/en-us/library/ms791514.aspx
+// Windows Device Driver Kit. Since that's inconvenient, the definitions are provided
+// here. See http://msdn.microsoft.com/en-us/library/ms791514.aspx
+
+#if !defined(REPARSE_DATA_BUFFER_HEADER_SIZE) // mingw winnt.h does provide the defs
#define SYMLINK_FLAG_RELATIVE 1
@@ -112,6 +114,7 @@
FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 )
+#endif
# else // BOOST_POSIX_API
Modified: sandbox/filesystem-v3/libs/filesystem/src/path.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/src/path.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/src/path.cpp 2009-12-12 17:35:43 EST (Sat, 12 Dec 2009)
@@ -266,7 +266,7 @@
return path(m_path.c_str() + itr.m_pos);
}
- path path::parent_path() const
+ string_type::size_type path::m_parent_path_end() const
{
size_type end_pos(filename_pos(m_path, m_path.size()));
@@ -283,10 +283,24 @@
--end_pos) {}
return (end_pos == 1 && root_dir_pos == 0 && filename_was_separator)
+ ? string_type::npos
+ : end_pos;
+ }
+
+ path path::parent_path() const
+ {
+ size_type end_pos(m_parent_path_end());
+ return end_pos == string_type::npos
? path()
: path(m_path.c_str(), m_path.c_str() + end_pos);
}
+ path& path::remove_filename()
+ {
+ m_path.erase(m_parent_path_end());
+ return *this;
+ }
+
path path::filename() const
{
size_type pos(filename_pos(m_path, m_path.size()));
@@ -316,12 +330,6 @@
: path(name.m_path.c_str() + pos);
}
- path & path::remove_filename()
- {
- m_path.erase(filename_pos(m_path, m_path.size()));
- return *this;
- }
-
path & path::replace_extension(const path & source)
{
// erase existing extension if any
Modified: sandbox/filesystem-v3/libs/filesystem/test/deprecated_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/deprecated_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/deprecated_test.cpp 2009-12-12 17:35:43 EST (Sat, 12 Dec 2009)
@@ -156,9 +156,9 @@
p.directory_string();
}
- // rename_test ----------------------------------------------------------------------//
+ // remove_leaf_test -----------------------------------------------------------------//
- void rename_test()
+ void remove_leaf_test()
{
fs::path p("foo/bar/blah");
@@ -204,7 +204,7 @@
BOOST_TEST(!fs::is_regular(ng)); // verify deprecated name still works
BOOST_TEST(!fs::symbolic_link_exists("nosuchfileordirectory"));
- rename_test();
+ remove_leaf_test();
//check_normalize();
Modified: sandbox/filesystem-v3/libs/filesystem/test/msvc/deprecated_test/deprecated_test.vcproj
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/msvc/deprecated_test/deprecated_test.vcproj (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/msvc/deprecated_test/deprecated_test.vcproj 2009-12-12 17:35:43 EST (Sat, 12 Dec 2009)
@@ -84,6 +84,8 @@
/>
<Tool
Name="VCPostBuildEventTool"
+ Description="Executing test $(TargetName).exe..."
+ CommandLine=""$(TargetDir)\$(TargetName).exe""
/>
</Configuration>
<Configuration
@@ -157,6 +159,8 @@
/>
<Tool
Name="VCPostBuildEventTool"
+ Description="Executing test $(TargetName).exe..."
+ CommandLine=""$(TargetDir)\$(TargetName).exe""
/>
</Configuration>
</Configurations>
Modified: sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp 2009-12-12 17:35:43 EST (Sat, 12 Dec 2009)
@@ -767,13 +767,13 @@
create_file(f, "1234567890");
BOOST_TEST(fs::exists(f));
- BOOST_TEST_EQ(fs::file_size(f), 10);
+ BOOST_TEST_EQ(fs::file_size(f), 10U);
fs::resize_file(f, 5);
BOOST_TEST(fs::exists(f));
- BOOST_TEST_EQ(fs::file_size(f), 5);
+ BOOST_TEST_EQ(fs::file_size(f), 5U);
fs::resize_file(f, 15);
BOOST_TEST(fs::exists(f));
- BOOST_TEST_EQ(fs::file_size(f), 15);
+ BOOST_TEST_EQ(fs::file_size(f), 15U);
error_code ec;
fs::resize_file("no such file", 15, ec);
Modified: sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp 2009-12-12 17:35:43 EST (Sat, 12 Dec 2009)
@@ -664,17 +664,22 @@
}
- // query_and_decomposition_tests -----------------------------------------//
+ // query_and_decomposition_tests ---------------------------------------------------//
+ //
+ // remove_filename() is also tested here, because its specification depends on
+ // a decomposition function.
void query_and_decomposition_tests()
{
std::cout << "query_and_decomposition_tests..." << std::endl;
path p;
+ path q;
- p = "";
+ p = q = "";
BOOST_TEST(p.relative_path().string() == "");
BOOST_TEST(p.parent_path().string() == "");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
BOOST_TEST(p.filename() == "");
BOOST_TEST(p.root_name() == "");
BOOST_TEST(p.root_directory() == "");
@@ -687,9 +692,10 @@
BOOST_TEST(!p.has_parent_path());
BOOST_TEST(!p.is_complete());
- p = "/";
+ p = q = "/";
BOOST_TEST(p.relative_path().string() == "");
BOOST_TEST(p.parent_path().string() == "");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
BOOST_TEST(p.filename() == "/");
BOOST_TEST(p.root_name() == "");
BOOST_TEST(p.root_directory() == "/");
@@ -705,9 +711,10 @@
else
BOOST_TEST(!p.is_complete());
- p = "//";
+ p = q = "//";
CHECK_EQUAL(p.relative_path().string(), "");
CHECK_EQUAL(p.parent_path().string(), "");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
CHECK_EQUAL(p.filename(), "//");
CHECK_EQUAL(p.root_name(), "//");
CHECK_EQUAL(p.root_directory(), "");
@@ -721,9 +728,10 @@
BOOST_TEST(!p.is_complete());
- p = "///";
+ p = q = "///";
CHECK_EQUAL(p.relative_path().string(), "");
CHECK_EQUAL(p.parent_path().string(), "");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
CHECK_EQUAL(p.filename(), "/");
CHECK_EQUAL(p.root_name(), "");
CHECK_EQUAL(p.root_directory(), "/");
@@ -739,9 +747,10 @@
else
BOOST_TEST(!p.is_complete());
- p = ".";
+ p = q = ".";
BOOST_TEST(p.relative_path().string() == ".");
BOOST_TEST(p.parent_path().string() == "");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
BOOST_TEST(p.filename() == ".");
BOOST_TEST(p.root_name() == "");
BOOST_TEST(p.root_directory() == "");
@@ -754,9 +763,10 @@
BOOST_TEST(!p.has_parent_path());
BOOST_TEST(!p.is_complete());
- p = "..";
+ p = q = "..";
BOOST_TEST(p.relative_path().string() == "..");
BOOST_TEST(p.parent_path().string() == "");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
BOOST_TEST(p.filename() == "..");
BOOST_TEST(p.root_name() == "");
BOOST_TEST(p.root_directory() == "");
@@ -769,9 +779,10 @@
BOOST_TEST(!p.has_parent_path());
BOOST_TEST(!p.is_complete());
- p = "foo";
+ p = q = "foo";
BOOST_TEST(p.relative_path().string() == "foo");
BOOST_TEST(p.parent_path().string() == "");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
BOOST_TEST(p.filename() == "foo");
BOOST_TEST(p.root_name() == "");
BOOST_TEST(p.root_directory() == "");
@@ -784,9 +795,10 @@
BOOST_TEST(!p.has_parent_path());
BOOST_TEST(!p.is_complete());
- p = "/foo";
+ p = q = "/foo";
CHECK_EQUAL(p.relative_path().string(), "foo");
CHECK_EQUAL(p.parent_path().string(), "/");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
CHECK_EQUAL(p.filename(), "foo");
CHECK_EQUAL(p.root_name(), "");
CHECK_EQUAL(p.root_directory(), "/");
@@ -802,9 +814,10 @@
else
BOOST_TEST(!p.is_complete());
- p = "/foo/";
+ p = q = "/foo/";
CHECK_EQUAL(p.relative_path().string(), "foo/");
CHECK_EQUAL(p.parent_path().string(), "/foo");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
CHECK_EQUAL(p.filename(), ".");
CHECK_EQUAL(p.root_name(), "");
CHECK_EQUAL(p.root_directory(), "/");
@@ -820,9 +833,10 @@
else
BOOST_TEST(!p.is_complete());
- p = "///foo";
+ p = q = "///foo";
CHECK_EQUAL(p.relative_path().string(), "foo");
CHECK_EQUAL(p.parent_path().string(), "/");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
CHECK_EQUAL(p.filename(), "foo");
CHECK_EQUAL(p.root_name(), "");
CHECK_EQUAL(p.root_directory(), "/");
@@ -838,9 +852,10 @@
else
BOOST_TEST(!p.is_complete());
- p = "foo/bar";
+ p = q = "foo/bar";
BOOST_TEST(p.relative_path().string() == "foo/bar");
BOOST_TEST(p.parent_path().string() == "foo");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
BOOST_TEST(p.filename() == "bar");
BOOST_TEST(p.root_name() == "");
BOOST_TEST(p.root_directory() == "");
@@ -853,9 +868,10 @@
BOOST_TEST(p.has_parent_path());
BOOST_TEST(!p.is_complete());
- p = "../foo";
+ p = q = "../foo";
BOOST_TEST(p.relative_path().string() == "../foo");
BOOST_TEST(p.parent_path().string() == "..");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
BOOST_TEST(p.filename() == "foo");
BOOST_TEST(p.root_name() == "");
BOOST_TEST(p.root_directory() == "");
@@ -868,9 +884,10 @@
BOOST_TEST(p.has_parent_path());
BOOST_TEST(!p.is_complete());
- p = "..///foo";
+ p = q = "..///foo";
CHECK_EQUAL(p.relative_path().string(), "..///foo");
CHECK_EQUAL(p.parent_path().string(), "..");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
CHECK_EQUAL(p.filename(), "foo");
CHECK_EQUAL(p.root_name(), "");
CHECK_EQUAL(p.root_directory(), "");
@@ -883,9 +900,10 @@
BOOST_TEST(p.has_parent_path());
BOOST_TEST(!p.is_complete());
- p = "/foo/bar";
+ p = q = "/foo/bar";
BOOST_TEST(p.relative_path().string() == "foo/bar");
BOOST_TEST(p.parent_path().string() == "/foo");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
BOOST_TEST(p.filename() == "bar");
BOOST_TEST(p.root_name() == "");
BOOST_TEST(p.root_directory() == "/");
@@ -907,9 +925,10 @@
PATH_CHECK(path("//resource/"), "//resource/");
PATH_CHECK(path("//resource/foo"), "//resource/foo");
- p = path("//net");
+ p = q = path("//net");
CHECK_EQUAL(p.string(), "//net");
CHECK_EQUAL(p.relative_path().string(), "");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
CHECK_EQUAL(p.parent_path().string(), "");
CHECK_EQUAL(p.filename(), "//net");
CHECK_EQUAL(p.root_name(), "//net");
@@ -923,9 +942,10 @@
BOOST_TEST(!p.has_parent_path());
BOOST_TEST(!p.is_complete());
- p = path("//net/");
+ p = q = path("//net/");
BOOST_TEST(p.relative_path().string() == "");
BOOST_TEST(p.parent_path().string() == "//net");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
BOOST_TEST(p.filename() == "/");
BOOST_TEST(p.root_name() == "//net");
BOOST_TEST(p.root_directory() == "/");
@@ -938,9 +958,10 @@
BOOST_TEST(p.has_parent_path());
BOOST_TEST(p.is_complete());
- p = path("//net/foo");
+ p = q = path("//net/foo");
BOOST_TEST(p.relative_path().string() == "foo");
BOOST_TEST(p.parent_path().string() == "//net/");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
BOOST_TEST(p.filename() == "foo");
BOOST_TEST(p.root_name() == "//net");
BOOST_TEST(p.root_directory() == "/");
@@ -953,9 +974,10 @@
BOOST_TEST(p.has_parent_path());
BOOST_TEST(p.is_complete());
- p = path("//net///foo");
+ p = q = path("//net///foo");
CHECK_EQUAL(p.relative_path().string(), "foo");
CHECK_EQUAL(p.parent_path().string(), "//net/");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
CHECK_EQUAL(p.filename(), "foo");
CHECK_EQUAL(p.root_name(), "//net");
CHECK_EQUAL(p.root_directory(), "/");
@@ -971,9 +993,10 @@
if (platform == "Windows")
{
- p = path("c:");
+ p = q = path("c:");
BOOST_TEST(p.relative_path().string() == "");
BOOST_TEST(p.parent_path().string() == "");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
BOOST_TEST(p.filename() == "c:");
BOOST_TEST(p.root_name() == "c:");
BOOST_TEST(p.root_directory() == "");
@@ -986,9 +1009,10 @@
BOOST_TEST(!p.has_parent_path());
BOOST_TEST(!p.is_complete());
- p = path("c:foo");
+ p = q = path("c:foo");
BOOST_TEST(p.relative_path().string() == "foo");
BOOST_TEST(p.parent_path().string() == "c:");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
BOOST_TEST(p.filename() == "foo");
BOOST_TEST(p.root_name() == "c:");
BOOST_TEST(p.root_directory() == "");
@@ -1001,9 +1025,10 @@
BOOST_TEST(p.has_parent_path());
BOOST_TEST(!p.is_complete());
- p = path("c:/");
+ p = q = path("c:/");
BOOST_TEST(p.relative_path().string() == "");
BOOST_TEST(p.parent_path().string() == "c:");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
BOOST_TEST(p.filename() == "/");
BOOST_TEST(p.root_name() == "c:");
BOOST_TEST(p.root_directory() == "/");
@@ -1016,9 +1041,10 @@
BOOST_TEST(p.has_parent_path());
BOOST_TEST(p.is_complete());
- p = path("c:..");
+ p = q = path("c:..");
BOOST_TEST(p.relative_path().string() == "..");
BOOST_TEST(p.parent_path().string() == "c:");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
BOOST_TEST(p.filename() == "..");
BOOST_TEST(p.root_name() == "c:");
BOOST_TEST(p.root_directory() == "");
@@ -1031,9 +1057,10 @@
BOOST_TEST(p.has_parent_path());
BOOST_TEST(!p.is_complete());
- p = path("c:/foo");
+ p = q = path("c:/foo");
CHECK_EQUAL(p.relative_path().string(), "foo");
CHECK_EQUAL(p.parent_path().string(), "c:/");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
CHECK_EQUAL(p.filename(), "foo");
CHECK_EQUAL(p.root_name(), "c:");
CHECK_EQUAL(p.root_directory(), "/");
@@ -1046,9 +1073,10 @@
BOOST_TEST(p.has_parent_path());
BOOST_TEST(p.is_complete());
- p = path("c://foo");
+ p = q = path("c://foo");
CHECK_EQUAL(p.relative_path().string(), "foo");
CHECK_EQUAL(p.parent_path().string(), "c:/");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
CHECK_EQUAL(p.filename(), "foo");
CHECK_EQUAL(p.root_name(), "c:");
CHECK_EQUAL(p.root_directory(), "/");
@@ -1061,9 +1089,10 @@
BOOST_TEST(p.has_parent_path());
BOOST_TEST(p.is_complete());
- p = path("c:\\foo\\bar");
+ p = q = path("c:\\foo\\bar");
CHECK_EQUAL(p.relative_path().string(), "foo\\bar");
CHECK_EQUAL(p.parent_path().string(), "c:\\foo");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
CHECK_EQUAL(p.filename(), "bar");
CHECK_EQUAL(p.root_name(), "c:");
CHECK_EQUAL(p.root_directory(), "\\");
@@ -1076,9 +1105,10 @@
BOOST_TEST(p.has_parent_path());
BOOST_TEST(p.is_complete());
- p = path("prn:");
+ p = q = path("prn:");
BOOST_TEST(p.relative_path().string() == "");
BOOST_TEST(p.parent_path().string() == "");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
BOOST_TEST(p.filename() == "prn:");
BOOST_TEST(p.root_name() == "prn:");
BOOST_TEST(p.root_directory() == "");
@@ -1091,9 +1121,10 @@
BOOST_TEST(!p.has_parent_path());
BOOST_TEST(!p.is_complete());
- p = path("\\\\net\\\\\\foo");
+ p = q = path("\\\\net\\\\\\foo");
CHECK_EQUAL(p.relative_path().string(), "foo");
CHECK_EQUAL(p.parent_path().string(), "\\\\net\\");
+ BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
CHECK_EQUAL(p.filename(), "foo");
CHECK_EQUAL(p.root_name(), "\\\\net");
CHECK_EQUAL(p.root_directory(), "\\");
Modified: sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp 2009-12-12 17:35:43 EST (Sat, 12 Dec 2009)
@@ -395,7 +395,7 @@
CHECK(path("").remove_filename() == "");
CHECK(path("foo").remove_filename() == "");
- CHECK(path("foo/bar").remove_filename() == "foo/");
+ CHECK(path("foo/bar").remove_filename() == "foo");
}
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