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

Unified Diff: test/cctest/test-ast-expression-visitor.cc

Issue 1319983004: Refactor type collector testing macros. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 5 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
Index: test/cctest/test-ast-expression-visitor.cc
diff --git a/test/cctest/test-ast-expression-visitor.cc b/test/cctest/test-ast-expression-visitor.cc
index f4c1028ab2b16c932820a4a609c6b06c53373cf9..448552c914d717e2b1469b7a99c98c89dce2b737 100644
--- a/test/cctest/test-ast-expression-visitor.cc
+++ b/test/cctest/test-ast-expression-visitor.cc
@@ -51,7 +51,8 @@ static void CollectTypes(HandleAndZoneScope* handles, const char* source,
TEST(VisitExpressions) {
v8::V8::Initialize();
HandleAndZoneScope handles;
- ZoneVector<ExpressionTypeEntry> types(handles.main_zone());
+ Zone* zone = handles.main_zone();
+ ZoneVector<ExpressionTypeEntry> types(zone);
const char test_function[] =
"function GeometricMean(stdlib, foreign, buffer) {\n"
" \"use asm\";\n"
@@ -273,7 +274,8 @@ TEST(VisitExpressions) {
TEST(VisitEmptyForStatment) {
v8::V8::Initialize();
HandleAndZoneScope handles;
- ZoneVector<ExpressionTypeEntry> types(handles.main_zone());
+ Zone* zone = handles.main_zone();
+ ZoneVector<ExpressionTypeEntry> types(zone);
// Check that traversing an empty for statement works.
const char test_function[] =
"function foo() {\n"
@@ -290,7 +292,8 @@ TEST(VisitEmptyForStatment) {
TEST(VisitSwitchStatment) {
v8::V8::Initialize();
HandleAndZoneScope handles;
- ZoneVector<ExpressionTypeEntry> types(handles.main_zone());
+ Zone* zone = handles.main_zone();
+ ZoneVector<ExpressionTypeEntry> types(zone);
// Check that traversing a switch with a default works.
const char test_function[] =
"function foo() {\n"
@@ -315,7 +318,8 @@ TEST(VisitSwitchStatment) {
TEST(VisitThrow) {
v8::V8::Initialize();
HandleAndZoneScope handles;
- ZoneVector<ExpressionTypeEntry> types(handles.main_zone());
+ Zone* zone = handles.main_zone();
+ ZoneVector<ExpressionTypeEntry> types(zone);
// Check that traversing an empty for statement works.
const char test_function[] =
"function foo() {\n"
@@ -334,7 +338,8 @@ TEST(VisitThrow) {
TEST(VisitYield) {
v8::V8::Initialize();
HandleAndZoneScope handles;
- ZoneVector<ExpressionTypeEntry> types(handles.main_zone());
+ Zone* zone = handles.main_zone();
+ ZoneVector<ExpressionTypeEntry> types(zone);
// Check that traversing an empty for statement works.
const char test_function[] =
"function* foo() {\n"
@@ -365,3 +370,27 @@ TEST(VisitYield) {
}
CHECK_TYPES_END
}
+
+
+TEST(VisitSkipping) {
+ v8::V8::Initialize();
+ HandleAndZoneScope handles;
+ Zone* zone = handles.main_zone();
+ ZoneVector<ExpressionTypeEntry> types(zone);
+ // Check that traversing an empty for statement works.
+ const char test_function[] =
+ "function foo(x) {\n"
+ " return (x + x) + 1;\n"
+ "}\n";
+ CollectTypes(&handles, test_function, &types);
+ CHECK_TYPES_BEGIN {
+ CHECK_EXPR(FunctionLiteral, DEFAULT_TYPE) {
+ CHECK_EXPR(BinaryOperation, DEFAULT_TYPE) {
+ // Skip x + x
+ CHECK_SKIP();
+ CHECK_EXPR(Literal, DEFAULT_TYPE);
+ }
+ }
+ }
+ CHECK_TYPES_END
+}

Powered by Google App Engine
This is Rietveld 408576698