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

Side by Side Diff: test/cctest/test-parsing.cc

Issue 919703003: WIP: Implement ES6 Spread-calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: AssignmentExpressions are not spreadable, add cctests for parsing Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 4880 matching lines...) Expand 10 before | Expand all | Expand 10 after
4891 "a,\ta, ...args", 4891 "a,\ta, ...args",
4892 "a,\ra, ...args", 4892 "a,\ra, ...args",
4893 "a,\na, ...args", 4893 "a,\na, ...args",
4894 NULL}; 4894 NULL};
4895 static const ParserFlag always_flags[] = {kAllowHarmonyRestParameters}; 4895 static const ParserFlag always_flags[] = {kAllowHarmonyRestParameters};
4896 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, 4896 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
4897 arraysize(always_flags)); 4897 arraysize(always_flags));
4898 } 4898 }
4899 4899
4900 4900
4901 TEST(SpreadCall) {
4902 const char* context_data[][2] = {{"function fn() { 'use strict';} fn(", ");"},
4903 {"function fn() {} fn(", ");"},
4904 {NULL, NULL}};
4905
4906 const char* data[] = {
4907 "...([1, 2, 3])",
4908 "...'123', ...'456'",
4909 "...new Set([1, 2, 3]), 4",
4910 "1, ...[2, 3], 4",
4911 "...Array(...[1,2,3,4])",
4912 "...NaN",
4913 NULL};
4914 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, NULL, 0);
4915 }
4916
4917
4918 TEST(SpreadCallErrors) {
4919 const char* context_data[][2] = {{"function fn() { 'use strict';} fn(", ");"},
4920 {"function fn() {} fn(", ");"},
4921 {NULL, NULL}};
4922
4923 const char* data[] = {
4924 "(...[1, 2, 3])",
4925 "......[1,2,3]",
arv (Not doing code reviews) 2015/02/12 21:41:34 maybe a test for ... outside Arguments?
caitp (gmail) 2015/02/12 21:58:54 will do
4926 NULL};
4927 RunParserSyncTest(context_data, data, kError, NULL, 0, NULL, 0);
4928 }
4929
4930
4901 TEST(LexicalScopingSloppyMode) { 4931 TEST(LexicalScopingSloppyMode) {
4902 const char* context_data[][2] = { 4932 const char* context_data[][2] = {
4903 {"", ""}, 4933 {"", ""},
4904 {"function f() {", "}"}, 4934 {"function f() {", "}"},
4905 {"{", "}"}, 4935 {"{", "}"},
4906 {NULL, NULL}}; 4936 {NULL, NULL}};
4907 const char* bad_data[] = { 4937 const char* bad_data[] = {
4908 "let x = 1;", 4938 "let x = 1;",
4909 "for(let x = 1;;){}", 4939 "for(let x = 1;;){}",
4910 "for(let x of []){}", 4940 "for(let x of []){}",
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
5336 "class C {static set arguments(_) {}}", 5366 "class C {static set arguments(_) {}}",
5337 5367
5338 NULL}; 5368 NULL};
5339 5369
5340 static const ParserFlag always_flags[] = { 5370 static const ParserFlag always_flags[] = {
5341 kAllowHarmonyClasses, kAllowHarmonyObjectLiterals, kAllowHarmonyScoping, 5371 kAllowHarmonyClasses, kAllowHarmonyObjectLiterals, kAllowHarmonyScoping,
5342 kAllowStrongMode}; 5372 kAllowStrongMode};
5343 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, 5373 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
5344 always_flags, arraysize(always_flags)); 5374 always_flags, arraysize(always_flags));
5345 } 5375 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698