Subject: [Boost-bugs] [Boost C++ Libraries] #10317: boost::test corrupts contents of argv if a paramter contains whitespace
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-08-06 15:33:22
#10317: boost::test corrupts contents of argv if a paramter contains whitespace
--------------------------------------------------+---------------------
Reporter: Andrew Marshall <planetmarshalluk@â¦> | Owner: rogeeff
Type: Bugs | Status: new
Milestone: To Be Determined | Component: test
Version: Boost 1.55.0 | Severity: Problem
Keywords: |
--------------------------------------------------+---------------------
command line arguments containing spaces are corrupted by the test
framework's internal command line parser. This is a problem if passing
additional arguments to the test executable containing, for example, paths
with spaces.
Compile and run the following with the argument "root\\foo bar\\file.txt"
{{{#!cpp
#include <string>
#include <boost/test/unit_test.hpp>
using namespace boost::test;
void command_line_parser_preserves_whitespace(const std::string & after) {
// this will fail as after = "root\\foo"
BOOST_REQUIRE_EQUAL(std::string("root\\foo bar\\file.txt", after);
}
bool init_function() {
framework::master_test_suite().
add( BOOST_TEST_CASE( boost::bind(
&command_line_parser_preserves_whitespace, std::string
path(framework::master_test_suite.path().argv[1]) ) ) )
return true;
}
int main( int argc, char* argv[] ) {
return ::boost::unit_test::unit_test_main( &init_function, argc, argv
);
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10317> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC