Skip to content

The behaviors to fatal assertions can be improved #708

@ILer32

Description

@ILer32
  • Problem
    For the following 2 examples,
    the first one does not terminate after the fatal assertion, while
    the second one terminates without handling exception.
    The behaviors to fatal assertions can be improved.
#include <boost/ut.hpp>
int main() {
    using namespace boost::ut;
    "basic"_test = [] {
        expect(1_i != 1) << fatal; // fatal assertion
        expect(2_i != 2) << "should not run the row";
        };
    expect(3_i != 3) << "should not run the row";
}
#include <boost/ut.hpp>
int main() {
    using namespace boost::ut;
    expect(1_i != 1) << fatal; // fatal assertion
    expect(2_i != 2) << "should not run the row";
}

Expected Behavior

UT starts =====================================================================
Running test "basic"...
FAILED in: ...\example.cpp:5 - test condition: [1 != 1]
=> terminated for the fatal issue
===============================================================================
Suite global
tests:   1 | 1 failed
asserts: 1 | 0 passed | 1 failed
Completed =====================================================================
UT starts =====================================================================
FAILED in: ...\example.cpp:4 - test condition: [1 != 1]
=> terminated for the fatal issue
===============================================================================
Suite global
tests:   0 | 0 failed
asserts: 1 | 0 passed | 1 failed
Completed =====================================================================

Actual Behavior

UT starts =====================================================================
Running test "basic"...
FAILED in: ...\example.cpp:5 - test condition: [1 != 1]
FAILED in: ...\example.cpp:8 - test condition: [3 != 3] should not run the row
===============================================================================
Suite global
tests:   1 | 1 failed
asserts: 2 | 0 passed | 2 failed
Completed =====================================================================
UT starts =====================================================================
FAILED in: ...\example.cpp:4 - test condition: [1 != 1]
===============================================================================
Suite global
tests:   0 | 0 failed
asserts: 1 | 0 passed | 1 failed

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