Skip to content

Feature Request: Implementing custom messages for REQUIRE/CHECK macros. #929

@haozhangphd

Description

@haozhangphd

Description

This is a feature Boost.Test has (BOOST_<level>_MESSAGE). It would be very nice if we can define custom error message if any specific test fails. A use-case is as follows:

int minutes = 100;
REQUIRE_MESSAGE( 0 <= minutes <= 59 , "Minutes " << minutes << " outside allowed range.");

Output:

Example.cpp:X: FAILED:
Minutes 100 outside allowed range.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions