瀏覽代碼

Test case added.

main
offa 7 年之前
父節點
當前提交
88120b7f1e
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. +9
    -0
      test/UniqueResourceTest.cpp

+ 9
- 0
test/UniqueResourceTest.cpp 查看文件

@@ -234,6 +234,15 @@ TEST_CASE("reset sets new value and calls deleter on previous", "[UniqueResource
guard.reset(Handle{7});
}

TEST_CASE("reset handles exception on assignment", "[UniqueResource]")
{
REQUIRE_CALL(m, deleter(3));
REQUIRE_CALL(m, deleter(7));
auto d = [](const auto& v) { deleter(v.m_handle); };
auto guard = sr::make_unique_resource(ConditialThrowOnCopyMock{3, false}, d);
guard.reset(ConditialThrowOnCopyMock{7, true});
}

TEST_CASE("release disables deleter", "[UniqueResource]")
{
REQUIRE_CALL(m, deleter(3)).TIMES(0);

Loading…
取消
儲存