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

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

Issue 1024603002: Remove --harmony-numeric-literal flag (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: git rebase Created 5 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 unified diff | Download patch
« no previous file with comments | « src/scanner.cc ('k') | test/mjsunit/es6/numeric-literals.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 i::DeleteArray(arg); 1366 i::DeleteArray(arg);
1367 data.Dispose(); 1367 data.Dispose();
1368 return i::Handle<i::String>::cast(result); 1368 return i::Handle<i::String>::cast(result);
1369 } 1369 }
1370 1370
1371 1371
1372 enum ParserFlag { 1372 enum ParserFlag {
1373 kAllowLazy, 1373 kAllowLazy,
1374 kAllowNatives, 1374 kAllowNatives,
1375 kAllowHarmonyModules, 1375 kAllowHarmonyModules,
1376 kAllowHarmonyNumericLiterals,
1377 kAllowHarmonyArrowFunctions, 1376 kAllowHarmonyArrowFunctions,
1378 kAllowHarmonyClasses, 1377 kAllowHarmonyClasses,
1379 kAllowHarmonyObjectLiterals, 1378 kAllowHarmonyObjectLiterals,
1380 kAllowHarmonyRestParameters, 1379 kAllowHarmonyRestParameters,
1381 kAllowHarmonySloppy, 1380 kAllowHarmonySloppy,
1382 kAllowHarmonyUnicode, 1381 kAllowHarmonyUnicode,
1383 kAllowHarmonyComputedPropertyNames, 1382 kAllowHarmonyComputedPropertyNames,
1384 kAllowStrongMode 1383 kAllowStrongMode
1385 }; 1384 };
1386 1385
1387 1386
1388 enum ParserSyncTestResult { 1387 enum ParserSyncTestResult {
1389 kSuccessOrError, 1388 kSuccessOrError,
1390 kSuccess, 1389 kSuccess,
1391 kError 1390 kError
1392 }; 1391 };
1393 1392
1394 template <typename Traits> 1393 template <typename Traits>
1395 void SetParserFlags(i::ParserBase<Traits>* parser, 1394 void SetParserFlags(i::ParserBase<Traits>* parser,
1396 i::EnumSet<ParserFlag> flags) { 1395 i::EnumSet<ParserFlag> flags) {
1397 parser->set_allow_lazy(flags.Contains(kAllowLazy)); 1396 parser->set_allow_lazy(flags.Contains(kAllowLazy));
1398 parser->set_allow_natives(flags.Contains(kAllowNatives)); 1397 parser->set_allow_natives(flags.Contains(kAllowNatives));
1399 parser->set_allow_harmony_modules(flags.Contains(kAllowHarmonyModules)); 1398 parser->set_allow_harmony_modules(flags.Contains(kAllowHarmonyModules));
1400 parser->set_allow_harmony_numeric_literals(
1401 flags.Contains(kAllowHarmonyNumericLiterals));
1402 parser->set_allow_harmony_object_literals( 1399 parser->set_allow_harmony_object_literals(
1403 flags.Contains(kAllowHarmonyObjectLiterals)); 1400 flags.Contains(kAllowHarmonyObjectLiterals));
1404 parser->set_allow_harmony_arrow_functions( 1401 parser->set_allow_harmony_arrow_functions(
1405 flags.Contains(kAllowHarmonyArrowFunctions)); 1402 flags.Contains(kAllowHarmonyArrowFunctions));
1406 parser->set_allow_harmony_classes(flags.Contains(kAllowHarmonyClasses)); 1403 parser->set_allow_harmony_classes(flags.Contains(kAllowHarmonyClasses));
1407 parser->set_allow_harmony_rest_params( 1404 parser->set_allow_harmony_rest_params(
1408 flags.Contains(kAllowHarmonyRestParameters)); 1405 flags.Contains(kAllowHarmonyRestParameters));
1409 parser->set_allow_harmony_sloppy(flags.Contains(kAllowHarmonySloppy)); 1406 parser->set_allow_harmony_sloppy(flags.Contains(kAllowHarmonySloppy));
1410 parser->set_allow_harmony_unicode(flags.Contains(kAllowHarmonyUnicode)); 1407 parser->set_allow_harmony_unicode(flags.Contains(kAllowHarmonyUnicode));
1411 parser->set_allow_harmony_computed_property_names( 1408 parser->set_allow_harmony_computed_property_names(
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 context_data[i][1]); 1658 context_data[i][1]);
1662 CHECK(length == kProgramSize); 1659 CHECK(length == kProgramSize);
1663 TestParserSync(program.start(), NULL, 0); 1660 TestParserSync(program.start(), NULL, 0);
1664 } 1661 }
1665 } 1662 }
1666 } 1663 }
1667 1664
1668 // Neither Harmony numeric literals nor our natives syntax have any 1665 // Neither Harmony numeric literals nor our natives syntax have any
1669 // interaction with the flags above, so test these separately to reduce 1666 // interaction with the flags above, so test these separately to reduce
1670 // the combinatorial explosion. 1667 // the combinatorial explosion.
1671 static const ParserFlag flags2[] = { kAllowHarmonyNumericLiterals }; 1668 TestParserSync("0o1234", NULL, 0);
1672 TestParserSync("0o1234", flags2, arraysize(flags2)); 1669 TestParserSync("0b1011", NULL, 0);
1673 TestParserSync("0b1011", flags2, arraysize(flags2));
1674 1670
1675 static const ParserFlag flags3[] = { kAllowNatives }; 1671 static const ParserFlag flags3[] = { kAllowNatives };
1676 TestParserSync("%DebugPrint(123)", flags3, arraysize(flags3)); 1672 TestParserSync("%DebugPrint(123)", flags3, arraysize(flags3));
1677 } 1673 }
1678 1674
1679 1675
1680 TEST(StrictOctal) { 1676 TEST(StrictOctal) {
1681 // Test that syntax error caused by octal literal is reported correctly as 1677 // Test that syntax error caused by octal literal is reported correctly as
1682 // such (issue 2220). 1678 // such (issue 2220).
1683 v8::V8::Initialize(); 1679 v8::V8::Initialize();
(...skipping 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after
4255 "class name { *", 4251 "class name { *",
4256 "class name { * }", 4252 "class name { * }",
4257 "class name { *; }", 4253 "class name { *; }",
4258 "class name { *get x() {} }", 4254 "class name { *get x() {} }",
4259 "class name { *set x(_) {} }", 4255 "class name { *set x(_) {} }",
4260 "class name { *static m() {} }", 4256 "class name { *static m() {} }",
4261 NULL}; 4257 NULL};
4262 4258
4263 static const ParserFlag always_flags[] = { 4259 static const ParserFlag always_flags[] = {
4264 kAllowHarmonyClasses, 4260 kAllowHarmonyClasses,
4265 kAllowHarmonyNumericLiterals,
4266 kAllowHarmonySloppy 4261 kAllowHarmonySloppy
4267 }; 4262 };
4268 RunParserSyncTest(context_data, class_data, kError, NULL, 0, 4263 RunParserSyncTest(context_data, class_data, kError, NULL, 0,
4269 always_flags, arraysize(always_flags)); 4264 always_flags, arraysize(always_flags));
4270 } 4265 }
4271 4266
4272 4267
4273 TEST(ClassNameErrors) { 4268 TEST(ClassNameErrors) {
4274 const char* context_data[][2] = {{"class ", "{}"}, 4269 const char* context_data[][2] = {{"class ", "{}"},
4275 {"(class ", "{});"}, 4270 {"(class ", "{});"},
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after
5800 v8::Script::Compile(v8_str(script3)); 5795 v8::Script::Compile(v8_str(script3));
5801 CHECK(try_catch2.HasCaught()); 5796 CHECK(try_catch2.HasCaught());
5802 v8::String::Utf8Value exception(try_catch2.Exception()); 5797 v8::String::Utf8Value exception(try_catch2.Exception());
5803 CHECK_EQ(0, 5798 CHECK_EQ(0,
5804 strcmp( 5799 strcmp(
5805 "ReferenceError: In strong mode, using an undeclared global " 5800 "ReferenceError: In strong mode, using an undeclared global "
5806 "variable 'not_there3' is not allowed", 5801 "variable 'not_there3' is not allowed",
5807 *exception)); 5802 *exception));
5808 } 5803 }
5809 } 5804 }
OLDNEW
« no previous file with comments | « src/scanner.cc ('k') | test/mjsunit/es6/numeric-literals.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698