Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / base / scoped_clear_errno_unittest.cc
blob8afb33e033c8f4a020eec099993da087b8148c54
1 // Copyright (c) 2013 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 <errno.h>
7 #include "base/scoped_clear_errno.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 namespace base {
12 TEST(ScopedClearErrno, TestNoError) {
13 errno = 1;
15 ScopedClearErrno clear_error;
16 EXPECT_EQ(0, errno);
18 EXPECT_EQ(1, errno);
21 TEST(ScopedClearErrno, TestError) {
22 errno = 1;
24 ScopedClearErrno clear_error;
25 errno = 2;
27 EXPECT_EQ(2, errno);
30 } // namespace base