| Index: base/scoped_clear_errno_unittest.cc
|
| diff --git a/base/scoped_clear_errno_unittest.cc b/base/scoped_clear_errno_unittest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ff69bddbbdaeb635a742d9682d54aaaf7a77292c
|
| --- /dev/null
|
| +++ b/base/scoped_clear_errno_unittest.cc
|
| @@ -0,0 +1,26 @@
|
| +// Copyright (c) 2013 The Chromium 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 <errno.h>
|
| +
|
| +#include "base/scoped_clear_errno.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +
|
| +TEST(ScopedClearErrno, TestNoError) {
|
| + errno = 1;
|
| + {
|
| + ScopedClearErrno clear_error;
|
| + EXPECT_EQ(0, errno);
|
| + }
|
| + EXPECT_EQ(1, errno);
|
| +}
|
| +
|
| +TEST(ScopedClearErrno, TestError) {
|
| + errno = 1;
|
| + {
|
| + ScopedClearErrno clear_error;
|
| + errno = 2;
|
| + }
|
| + EXPECT_EQ(2, errno);
|
| +}
|
|
|