Opened 6 years ago
Closed 5 years ago
#12631 closed Bugs (fixed)
BOOST_TEST_MESSAGE generates incorrect output when used in BOOST_DATA_TEST_CASE
Reported by: | Owned by: | Raffi Enficiaud | |
---|---|---|---|
Milestone: | Boost 1.65.0 | Component: | test |
Version: | Boost 1.61.0 | Severity: | Problem |
Keywords: | Cc: |
Description
When I use BOOST_TEST_MESSAGE in a BOOST_DATA_TEST_CASE, I get the following misleading/incorrect output:
Entering test case "test_update" Testing update : Failure occurred in a following context: filename = util/test_image2.jpg; Update Volume with 100 Failure occurred in a following context: filename = util/test_image2.jpg; Test case TestReadImageComment/test_update did not check any assertions
The context is the the boost data test case arguments even though there are no test errors. I tried debugging the code, but how to fix this is not obvious to me.
Here is the modified test from the BOOST_TEST_MESSAGE documentation:
#if 0 BOOST_AUTO_TEST_CASE(test_update) //, *utf::disabled()) #else std::string filenames[] = { "util/test_image2.jpg" }; BOOST_DATA_TEST_CASE(test_update, btd::make(filenames), filename) #endif { std::string field_name = "Volume"; int value = 100; BOOST_TEST_MESSAGE("Testing update :"); BOOST_TEST_MESSAGE("Update " << field_name << " with " << value); }
Change History (6)
comment:1 by , 6 years ago
Owner: | changed from | to
---|
comment:2 by , 6 years ago
comment:3 by , 6 years ago
Status: | new → assigned |
---|---|
Version: | Boost 1.61.0 → Boost 1.65.0 |
comment:4 by , 6 years ago
Yes, I think that will do just fine. You have eliminated the clause "Failure occurred", which was the reason I wrote the original ticket.
comment:5 by , 5 years ago
Milestone: | To Be Determined → Boost 1.65.0 |
---|---|
Version: | Boost 1.65.0 → Boost 1.61.0 |
comment:6 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
In master, rev 3ddb0e0d29e8ebfe4ba20921a3d366f7b5b837b2
Note:
See TracTickets
for help on using tickets.
Would something like
do instead? Unfortunately it will be hard to discard the second printing. Discarding any printing of context might be not desired in some circumstances as well.