1 // Copyright 2019 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/auto_reset.h"
9 #include "testing/gtest/include/gtest/gtest.h"
13 TEST(AutoReset, Move) {
16 AutoReset<int> resetter1{&value, 20};
20 AutoReset<int> resetter2 = std::move(resetter1);
21 // Moving to a new resetter does not change the value;
24 // Moved-to `resetter2` is out of scoped, and resets to the original value
25 // that was in moved-from `resetter1`.
29 // Moved-from `resetter1` does not reset to anything.
30 EXPECT_EQ(105, value);