瀏覽代碼

Test cases added (#47).

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

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

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

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

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


Loading…
取消
儲存