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

Unified Diff: test/cctest/test-utils.cc

Issue 440663002: Enable C++11. Synch toolchains with Chrome. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Disabled test on VisualStudio for now. Created 6 years, 4 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 | « src/json-parser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-utils.cc
diff --git a/test/cctest/test-utils.cc b/test/cctest/test-utils.cc
index c1dae6484a2d6e0a81217c2f8045d7b0cbf9d7ea..cf34f69be1f3e9ceb6bcc0fc5aeb6224fbf24b9e 100644
--- a/test/cctest/test-utils.cc
+++ b/test/cctest/test-utils.cc
@@ -27,6 +27,8 @@
#include <stdlib.h>
+#include <vector>
+
#include "src/v8.h"
#include "src/base/platform/platform.h"
@@ -218,3 +220,40 @@ TEST(SequenceCollectorRegression) {
CHECK_EQ(0, strncmp("0123456789012345678901234567890123",
seq.start(), seq.length()));
}
+
+
+// TODO(svenpanne) Unconditionally test this when our infrastructure is fixed.
+#if !V8_CC_MSVC
+TEST(CPlusPlus11Features) {
+ struct S {
+ bool x;
+ struct T {
+ double y;
+ int z[3];
+ } t;
+ };
+ S s{true, {3.1415, {1, 2, 3}}};
+ CHECK_EQ(2, s.t.z[1]);
+
+// TODO(svenpanne) Remove the old-skool code when we ship the new C++ headers.
+#if 0
+ std::vector<int> vec{11, 22, 33, 44};
+#else
+ std::vector<int> vec;
+ vec.push_back(11);
+ vec.push_back(22);
+ vec.push_back(33);
+ vec.push_back(44);
+#endif
+ vec.push_back(55);
+ vec.push_back(66);
+ for (auto& i : vec) {
+ ++i;
+ }
+ int j = 12;
+ for (auto i : vec) {
+ CHECK_EQ(j, i);
+ j += 11;
+ }
+}
+#endif
« no previous file with comments | « src/json-parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698