mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Figured out test failures, removed move test
We shouldn't be moving these `final_action`s around, that wasn't part of the C++CG design requirements. Went back to the simple version of `final_action`.
This commit is contained in:
parent
e9c575300e
commit
f59cb795a0
@ -52,14 +52,14 @@ template <class F>
|
||||
class final_action
|
||||
{
|
||||
public:
|
||||
explicit final_action(F f) : f_(std::move(f)) { }
|
||||
~final_action() { f_(); }
|
||||
explicit final_action(F f_) : f(f_) { }
|
||||
~final_action() { f(); }
|
||||
|
||||
final_action(const final_action&) = default;
|
||||
final_action& operator=(const final_action&) = default;
|
||||
final_action(const final_action& rhs) = delete;
|
||||
final_action& operator=(const final_action&) = delete;
|
||||
|
||||
private:
|
||||
F f_;
|
||||
F f;
|
||||
};
|
||||
|
||||
// finally() - convenience function to generate a final_action
|
||||
|
@ -51,25 +51,6 @@ TEST(utils_tests, finally_lambda)
|
||||
EXPECT_TRUE(i == 1);
|
||||
}
|
||||
|
||||
TEST(utils_tests, finally_lambda_move)
|
||||
{
|
||||
int i = 0;
|
||||
{
|
||||
auto _1 = finally([&]() { f(i); });
|
||||
{
|
||||
auto _2 = std::move(_1);
|
||||
EXPECT_TRUE(i == 0);
|
||||
}
|
||||
EXPECT_TRUE(i == 1);
|
||||
{
|
||||
auto _2 = std::move(_1);
|
||||
EXPECT_TRUE(i == 1);
|
||||
}
|
||||
EXPECT_TRUE(i == 1);
|
||||
}
|
||||
EXPECT_TRUE(i == 1);
|
||||
}
|
||||
|
||||
TEST(utils_tests, finally_const_lvalue_lambda)
|
||||
{
|
||||
int i = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user