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

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

Issue 2510873005: A decimal integer literal with a leading 0 is now an error in strict mode. (Closed)
Patch Set: Created 4 years, 1 month 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 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1608 const char* script = 1608 const char* script =
1609 "\"use strict\"; \n" 1609 "\"use strict\"; \n"
1610 "a = function() { \n" 1610 "a = function() { \n"
1611 " b = function() { \n" 1611 " b = function() { \n"
1612 " 01; \n" 1612 " 01; \n"
1613 " }; \n" 1613 " }; \n"
1614 "}; \n"; 1614 "}; \n";
1615 v8_compile(v8_str(script)); 1615 v8_compile(v8_str(script));
1616 CHECK(try_catch.HasCaught()); 1616 CHECK(try_catch.HasCaught());
1617 v8::String::Utf8Value exception(try_catch.Exception()); 1617 v8::String::Utf8Value exception(try_catch.Exception());
1618 CHECK_EQ(0, 1618 CHECK_EQ(0, strcmp("SyntaxError: Number literals must not have a '0' prefix "
1619 strcmp("SyntaxError: Octal literals are not allowed in strict mode.", 1619 "in strict mode.",
1620 *exception)); 1620 *exception));
1621 } 1621 }
1622 1622
1623 1623
1624 void RunParserSyncTest(const char* context_data[][2], 1624 void RunParserSyncTest(const char* context_data[][2],
1625 const char* statement_data[], 1625 const char* statement_data[],
1626 ParserSyncTestResult result, 1626 ParserSyncTestResult result,
1627 const ParserFlag* flags = NULL, int flags_len = 0, 1627 const ParserFlag* flags = NULL, int flags_len = 0,
1628 const ParserFlag* always_true_flags = NULL, 1628 const ParserFlag* always_true_flags = NULL,
1629 int always_true_len = 0, 1629 int always_true_len = 0,
1630 const ParserFlag* always_false_flags = NULL, 1630 const ParserFlag* always_false_flags = NULL,
(...skipping 6692 matching lines...) Expand 10 before | Expand all | Expand 10 after
8323 const char* data[] = { 8323 const char* data[] = {
8324 "const arguments = 1", 8324 "const arguments = 1",
8325 "let arguments", 8325 "let arguments",
8326 "var arguments", 8326 "var arguments",
8327 NULL 8327 NULL
8328 }; 8328 };
8329 // clang-format on 8329 // clang-format on
8330 RunParserSyncTest(context_data, data, kSuccess); 8330 RunParserSyncTest(context_data, data, kSuccess);
8331 } 8331 }
8332 } 8332 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698