Opened 13 years ago

Closed 7 years ago

#3384 closed Bugs (fixed)

Double-quoted arguments including spaces are divided by Boost.Test.

Reported by: Shuji Yamasaki <shu@…> Owned by: Raffi Enficiaud
Milestone: Boost 1.60.0 Component: test
Version: Boost 1.41.0 Severity: Problem
Keywords: test Cc:

Description

The commandline

test --opt "a b"

is parsed as

test --opt a b

.

argv_traverser, which re-tokenizes argv, is the culprit. After m_traverser.remainder( argc, argv ) at boost\test\utils\runtime\cla\parser.ipp:(159), the argc increases.

Attachments (1)

argv_traverser.ipp.patch (429 bytes ) - added by Shuji Yamasaki <shu@…> 13 years ago.
patch

Download all attachments as: .zip

Change History (8)

comment:1 by Shuji Yamasaki <shu@…>, 13 years ago

Component: Nonetest
Owner: set to Gennadiy Rozental

by Shuji Yamasaki <shu@…>, 13 years ago

Attachment: argv_traverser.ipp.patch added

patch

comment:2 by Shuji Yamasaki <shu@…>, 13 years ago

Milestone: Boost 1.41.0Boost 1.42.0
Summary: Double-quoted arguments including spaces can't be used with Boost.Test.Double-quoted arguments including spaces are divided by Boost.Test.
Version: Boost 1.40.0Boost 1.41.0

I wrote a test program and fixed the problem, though I don't know whether the problem is really a bug or not.

Test Program:

#include <boost/test/included/unit_test.hpp>
#include <iostream>
#include <vector>

using namespace std;
using namespace boost;
using namespace boost::unit_test;

test_suite* init_unit_test_suite(int argc, char* argv[])
{
  cout << argc - 1 << endl;
  for(int i = 1; i < argc; ++i)
    cout << argv[i] << endl;

  return 0;
}

Compile it into test.exe and run it as

test "first second"

, and then you'll get a result such as:
2
first
second

After patching:
1
first second

comment:3 by Gennadiy Rozental, 7 years ago

Milestone: Boost 1.42.0Boost 1.60.0
Resolution: fixed
Status: newclosed

This is addressed in trunk and is going to be released with next version of Boost

comment:4 by Raffi Enficiaud, 7 years ago

Resolution: fixed
Status: closedreopened

reopening for keeping track of the change

comment:5 by Raffi Enficiaud, 7 years ago

Owner: changed from Gennadiy Rozental to Raffi Enficiaud
Status: reopenednew

comment:6 by Raffi Enficiaud, 7 years ago

Status: newassigned

comment:7 by Raffi Enficiaud, 7 years ago

Resolution: fixed
Status: assignedclosed

merged to master

Note: See TracTickets for help on using tickets.