瀏覽代碼

Test case added (#47).

main
offa 7 年之前
父節點
當前提交
2567ef98e0
共有 1 個檔案被更改,包括 25 行新增0 行删除
  1. +25
    -0
      test/ScopeSuccessTest.cpp

+ 25
- 0
test/ScopeSuccessTest.cpp 查看文件

@@ -155,3 +155,28 @@ TEST_CASE("move transfers state if released", "[ScopeSuccess]")
static_cast<void>(guard);
}

TEST_CASE("deleter not called on exception", "[ScopeFail]")
{
try
{
auto guard = sr::make_scope_success(deleter);
throw 3;
}
catch( ... )
{
}
}

TEST_CASE("deleter called on pending exception", "[ScopeFail]")
{
try
{
throw 3;
}
catch( ... )
{
REQUIRE_CALL(m, deleter());
auto guard = sr::make_scope_success(deleter);
}
}


Loading…
取消
儲存