Modify

Opened 12 months ago

Closed 4 months ago

#12631 closed Bugs (fixed)

BOOST_TEST_MESSAGE generates incorrect output when used in BOOST_DATA_TEST_CASE

Reported by: Philip Miller <philip.miller@…> 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);
}

Attachments (0)

Change History (6)

comment:1 Changed 10 months ago by Raffi Enficiaud

Owner: changed from Gennadiy Rozental to Raffi Enficiaud

comment:2 Changed 8 months ago by Raffi Enficiaud

Would something like

Running 1 test case...
Entering test module "message in dataset"
/Users/raffi/Personnel/boost_github/libs/test/test/framework-ts/message-in-datatestcase-test.cpp:17: Entering test suite "test_update"
/Users/raffi/Personnel/boost_github/libs/test/test/framework-ts/message-in-datatestcase-test.cpp:17: Entering test case "_0"
Testing update :
Message generated in the following context:
    sample = util/test_image2.jpg; 
Update Volume with 100
Message generated in the following context:
    sample = util/test_image2.jpg; 
Test case test_update/_0 did not check any assertions
/Users/raffi/Personnel/boost_github/libs/test/test/framework-ts/message-in-datatestcase-test.cpp:17: Leaving test case "_0"; testing time: 111us
/Users/raffi/Personnel/boost_github/libs/test/test/framework-ts/message-in-datatestcase-test.cpp:17: Leaving test suite "test_update"; testing time: 163us
Leaving test module "message in dataset"; testing time: 197us

*** No errors detected
Program ended with exit code: 0

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.

comment:3 Changed 8 months ago by Raffi Enficiaud

Status: newassigned
Version: Boost 1.61.0Boost 1.65.0

comment:4 Changed 8 months ago by anonymous

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 Changed 5 months ago by Raffi Enficiaud

Milestone: To Be DeterminedBoost 1.65.0
Version: Boost 1.65.0Boost 1.61.0

comment:6 Changed 4 months ago by Raffi Enficiaud

Resolution: fixed
Status: assignedclosed

In master, rev 3ddb0e0d29e8ebfe4ba20921a3d366f7b5b837b2

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Raffi Enficiaud.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.