blob: ac1d613e7c4fe92413e8d1f90d0bcc4e9e67bb99 [file] [log] [blame]
// Copyright 2018 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "core/fxcrt/autorestorer.h"
#include "testing/gtest/include/gtest/gtest.h"
TEST(fxcrt, AutoRestorer) {
int x = 5;
{
AutoRestorer<int> restorer(&x);
x = 6;
EXPECT_EQ(6, x);
}
EXPECT_EQ(5, x);
{
AutoRestorer<int> restorer(&x);
x = 6;
EXPECT_EQ(6, x);
restorer.AbandonRestoration();
}
EXPECT_EQ(6, x);
}