| 32 | } |
| 33 | |
| 34 | TEST(CleanupTest, BasicLambda) { |
| 35 | string s = "active"; |
| 36 | { |
| 37 | auto s_cleaner = gtl::MakeCleanup([&s] { s.assign("cleaned"); }); |
| 38 | EXPECT_EQ("active", s); |
| 39 | } |
| 40 | EXPECT_EQ("cleaned", s); |
| 41 | } |
| 42 | |
| 43 | TEST(FinallyTest, NoCaptureLambda) { |
| 44 | // Noncapturing lambdas are just structs and use aggregate initializers. |