Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(688)

Unified Diff: base/scoped_clear_errno_unittest.cc

Issue 14749003: Stop overwriting errno in base::StringPrintf, StringAppendV, and StringToDouble (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comment Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/scoped_clear_errno.h ('k') | base/stringprintf.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8afb33e033c8f4a020eec099993da087b8148c54
--- /dev/null
+++ b/base/scoped_clear_errno_unittest.cc
@@ -0,0 +1,30 @@
+// 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"
+
+namespace base {
+
+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);
+}
+
+} // namespace base
« no previous file with comments | « base/scoped_clear_errno.h ('k') | base/stringprintf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698