Opened 8 years ago
Closed 7 years ago
#10317 closed Bugs (fixed)
boost::test corrupts contents of argv if a paramter contains whitespace
Reported by: | Owned by: | Raffi Enficiaud | |
---|---|---|---|
Milestone: | Boost 1.60.0 | Component: | test |
Version: | Boost 1.55.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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"
#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 ); }
Change History (5)
comment:1 by , 7 years ago
Milestone: | To Be Determined → Boost 1.60.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:2 by , 7 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
reopening for keeping track of the change
comment:3 by , 7 years ago
Owner: | changed from | to
---|---|
Status: | reopened → new |
comment:4 by , 7 years ago
Status: | new → assigned |
---|
Note:
See TracTickets
for help on using tickets.
This is addressed in trunk and is going to be released with next version of Boost