Opened 13 years ago
Closed 7 years ago
#3384 closed Bugs (fixed)
Double-quoted arguments including spaces are divided by Boost.Test.
| Reported by: | 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)
Change History (8)
comment:1 by , 13 years ago
| Component: | None → test |
|---|---|
| Owner: | set to |
by , 13 years ago
| Attachment: | argv_traverser.ipp.patch added |
|---|
comment:2 by , 13 years ago
| Milestone: | Boost 1.41.0 → Boost 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.0 → Boost 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 , 7 years ago
| Milestone: | Boost 1.42.0 → Boost 1.60.0 |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
This is addressed in trunk and is going to be released with next version of Boost
comment:4 by , 7 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
reopening for keeping track of the change
comment:5 by , 7 years ago
| Owner: | changed from to |
|---|---|
| Status: | reopened → new |
comment:6 by , 7 years ago
| Status: | new → assigned |
|---|

patch