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

Unified Diff: third_party/WebKit/Source/wtf/AssertionsTest.cpp

Issue 2626813002: Add trivial unit-tests for WTF assertion macros. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/AssertionsTest.cpp
diff --git a/third_party/WebKit/Source/wtf/AssertionsTest.cpp b/third_party/WebKit/Source/wtf/AssertionsTest.cpp
index 3da4ee23a9aa9269c9ef3dbf66c4c51c33b6b542..76fc8013ab59d8856819d39ad99c94e794bb90c2 100644
--- a/third_party/WebKit/Source/wtf/AssertionsTest.cpp
+++ b/third_party/WebKit/Source/wtf/AssertionsTest.cpp
@@ -8,9 +8,31 @@
#include "wtf/text/StringBuilder.h"
#include <stdio.h>
-#if !LOG_DISABLED
namespace WTF {
+TEST(AssertionsTest, Assertions) {
+ ASSERT(true);
+#if ENABLE(ASSERT)
+ EXPECT_DEATH_IF_SUPPORTED(ASSERT(false), "");
+ EXPECT_DEATH_IF_SUPPORTED(ASSERT_NOT_REACHED(), "");
+#endif
+
+ RELEASE_ASSERT(true);
+ EXPECT_DEATH_IF_SUPPORTED(RELEASE_ASSERT(false), "");
+
+ SECURITY_DCHECK(true);
+#if ENABLE(SECURITY_ASSERT)
+ EXPECT_DEATH_IF_SUPPORTED(SECURITY_DCHECK(false), "");
+#endif
+
+ SECURITY_CHECK(true);
+ EXPECT_DEATH_IF_SUPPORTED(SECURITY_CHECK(false), "");
+
+ EXPECT_DEATH_IF_SUPPORTED(CRASH(), "");
+ EXPECT_DEATH_IF_SUPPORTED(IMMEDIATE_CRASH(), "");
+};
+
+#if !LOG_DISABLED
static const int kPrinterBufferSize = 256;
static char gBuffer[kPrinterBufferSize];
static StringBuilder gBuilder;
@@ -45,6 +67,6 @@ TEST(AssertionsTest, ScopedLogger) {
")\n",
gBuilder.toString());
};
+#endif // !LOG_DISABLED
} // namespace WTF
-#endif // !LOG_DISABLED
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698