Skip to content

v16

Choose a tag to compare

@rollbear rollbear released this 16 May 04:17
  • .IN_SEQUENCE(...) can now be used with REQUIRE_DESTRUCTION(...)
    and NAMED_REQUIRE_DESTRUCTION(...) to ensure objects are destroyed in the intended order.
    Example:

    auto p1 = new trompeloeil::deathwatched<mock1>;
    auto p2 = new trompeloeil::deathwatched<mock2>;
    
    trompeloeil::sequence s;
    REQUIRE_DESTRUCTION(*p1)
      .IN_SEQUENCE(s);
    REQUIRE_DESTRUCTION(*p2)
      .IN_SEQUENCE(s);
    call_destroyer(p1, p2); // both must be destroyed, p1 before p2.
  • class trompeloeil::lifetime_monitor now inherits from class trompeloeil::expectation, so using

    std::unique_ptr<expectation> p = NAMED_REQUIRE_DESTRUCTION(obj);

    instead of

    std::unique_ptr<lifetime_monitor> p = NAMED_REQUIRE_DESTRUCTION(obj);

    works equally well, reduces the cognitive load a bit, and seems to build slightly faster.