Boost C++ Libraries: Ticket #10317: boost::test corrupts contents of argv if a paramter contains whitespace https://svn.boost.org/trac10/ticket/10317 <p> 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. </p> <p> Compile and run the following with the argument "root<br />foo bar<br />file.txt" </p> <div class="wiki-code"><div class="code"><pre> <span class="cp">#include</span> <span class="cpf">&lt;string&gt;</span><span class="cp"></span> <span class="cp">#include</span> <span class="cpf">&lt;boost/test/unit_test.hpp&gt;</span><span class="cp"></span> <span class="k">using</span> <span class="k">namespace</span> <span class="n">boost</span><span class="o">::</span><span class="n">test</span><span class="p">;</span> <span class="kt">void</span> <span class="nf">command_line_parser_preserves_whitespace</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span> <span class="n">after</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// this will fail as after = &quot;root\\foo&quot;</span> <span class="n">BOOST_REQUIRE_EQUAL</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;root</span><span class="se">\\</span><span class="s">foo bar</span><span class="se">\\</span><span class="s">file.txt&quot;</span><span class="p">,</span> <span class="n">after</span><span class="p">);</span> <span class="p">}</span> <span class="kt">bool</span> <span class="nf">init_function</span><span class="p">()</span> <span class="p">{</span> <span class="n">framework</span><span class="o">::</span><span class="n">master_test_suite</span><span class="p">().</span> <span class="n">add</span><span class="p">(</span> <span class="n">BOOST_TEST_CASE</span><span class="p">(</span> <span class="n">boost</span><span class="o">::</span><span class="n">bind</span><span class="p">(</span> <span class="o">&amp;</span><span class="n">command_line_parser_preserves_whitespace</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">path</span><span class="p">(</span><span class="n">framework</span><span class="o">::</span><span class="n">master_test_suite</span><span class="p">.</span><span class="n">path</span><span class="p">().</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span> <span class="p">)</span> <span class="p">)</span> <span class="p">)</span> <span class="k">return</span> <span class="nb">true</span><span class="p">;</span> <span class="p">}</span> <span class="kt">int</span> <span class="nf">main</span><span class="p">(</span> <span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">*</span> <span class="n">argv</span><span class="p">[]</span> <span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="o">::</span><span class="n">boost</span><span class="o">::</span><span class="n">unit_test</span><span class="o">::</span><span class="n">unit_test_main</span><span class="p">(</span> <span class="o">&amp;</span><span class="n">init_function</span><span class="p">,</span> <span class="n">argc</span><span class="p">,</span> <span class="n">argv</span> <span class="p">);</span> <span class="p">}</span> </pre></div></div> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10317 Trac 1.4.3 Gennadiy Rozental Wed, 30 Sep 2015 22:30:11 GMT status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/10317#comment:1 https://svn.boost.org/trac10/ticket/10317#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.60.0</span> </li> </ul> <p> This is addressed in trunk and is going to be released with next version of Boost </p> Ticket Raffi Enficiaud Tue, 27 Oct 2015 12:44:59 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/10317#comment:2 https://svn.boost.org/trac10/ticket/10317#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> reopening for keeping track of the change </p> Ticket Raffi Enficiaud Tue, 27 Oct 2015 12:45:06 GMT owner, status changed https://svn.boost.org/trac10/ticket/10317#comment:3 https://svn.boost.org/trac10/ticket/10317#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Gennadiy Rozental</span> to <span class="trac-author">Raffi Enficiaud</span> </li> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">new</span> </li> </ul> Ticket Raffi Enficiaud Tue, 27 Oct 2015 12:53:56 GMT status changed https://svn.boost.org/trac10/ticket/10317#comment:4 https://svn.boost.org/trac10/ticket/10317#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket Raffi Enficiaud Mon, 02 Nov 2015 10:11:15 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/10317#comment:5 https://svn.boost.org/trac10/ticket/10317#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> merged to master </p> Ticket