| OLD | NEW |
| 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 4803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4814 arraysize(always_flags)); | 4814 arraysize(always_flags)); |
| 4815 } | 4815 } |
| 4816 | 4816 |
| 4817 | 4817 |
| 4818 TEST(ParseRestParameters) { | 4818 TEST(ParseRestParameters) { |
| 4819 const char* context_data[][2] = {{"'use strict';(function(", | 4819 const char* context_data[][2] = {{"'use strict';(function(", |
| 4820 "){ return args;})(1, [], /regexp/, 'str'," | 4820 "){ return args;})(1, [], /regexp/, 'str'," |
| 4821 "function(){});"}, | 4821 "function(){});"}, |
| 4822 {"(function(", "){ return args;})(1, []," | 4822 {"(function(", "){ return args;})(1, []," |
| 4823 "/regexp/, 'str', function(){});"}, | 4823 "/regexp/, 'str', function(){});"}, |
| 4824 {"((", ") => args)(1, [], /regexp/, 'str'," |
| 4825 "function(){});"}, |
| 4824 {NULL, NULL}}; | 4826 {NULL, NULL}}; |
| 4825 | 4827 |
| 4826 const char* data[] = { | 4828 const char* data[] = { |
| 4827 "...args", | 4829 "...args", |
| 4828 "a, ...args", | 4830 "a, ...args", |
| 4829 "... args", | 4831 "... args", |
| 4830 "a, ... args", | 4832 "a, ... args", |
| 4831 "...\targs", | 4833 "...\targs", |
| 4832 "a, ...\targs", | 4834 "a, ...\targs", |
| 4833 "...\r\nargs", | 4835 "...\r\nargs", |
| 4834 "a, ...\r\nargs", | 4836 "a, ...\r\nargs", |
| 4835 "...\rargs", | 4837 "...\rargs", |
| 4836 "a, ...\rargs", | 4838 "a, ...\rargs", |
| 4837 "...\t\n\t\t\n args", | 4839 "...\t\n\t\t\n args", |
| 4838 "a, ... \n \n args", | 4840 "a, ... \n \n args", |
| 4839 NULL}; | 4841 NULL}; |
| 4840 static const ParserFlag always_flags[] = {kAllowHarmonyRestParameters}; | 4842 static const ParserFlag always_flags[] = |
| 4843 {kAllowHarmonyRestParameters, kAllowHarmonyArrowFunctions}; |
| 4841 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, | 4844 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, |
| 4842 arraysize(always_flags)); | 4845 arraysize(always_flags)); |
| 4843 } | 4846 } |
| 4844 | 4847 |
| 4845 | 4848 |
| 4846 TEST(ParseRestParametersErrors) { | 4849 TEST(ParseRestParametersErrors) { |
| 4847 const char* context_data[][2] = {{"'use strict';(function(", | 4850 const char* context_data[][2] = {{"'use strict';(function(", |
| 4848 "){ return args;}(1, [], /regexp/, 'str'," | 4851 "){ return args;}(1, [], /regexp/, 'str'," |
| 4849 "function(){});"}, | 4852 "function(){});"}, |
| 4850 {"(function(", "){ return args;}(1, []," | 4853 {"(function(", "){ return args;}(1, []," |
| 4851 "/regexp/, 'str', function(){});"}, | 4854 "/regexp/, 'str', function(){});"}, |
| 4855 {"((", ") => args)(1, [], /regexp/, 'str'," |
| 4856 "function(){});"}, |
| 4852 {NULL, NULL}}; | 4857 {NULL, NULL}}; |
| 4853 | 4858 |
| 4854 const char* data[] = { | 4859 const char* data[] = { |
| 4855 "...args, b", | 4860 "...args, b", |
| 4856 "a, ...args, b", | 4861 "a, ...args, b", |
| 4857 "...args, b", | 4862 "...args, b", |
| 4858 "a, ...args, b", | 4863 "a, ...args, b", |
| 4859 "...args,\tb", | 4864 "...args,\tb", |
| 4860 "a,...args\t,b", | 4865 "a,...args\t,b", |
| 4861 "...args\r\n, b", | 4866 "...args\r\n, b", |
| 4862 "a, ... args,\r\nb", | 4867 "a, ... args,\r\nb", |
| 4863 "...args\r,b", | 4868 "...args\r,b", |
| 4864 "a, ... args,\rb", | 4869 "a, ... args,\rb", |
| 4865 "...args\t\n\t\t\n, b", | 4870 "...args\t\n\t\t\n, b", |
| 4866 "a, ... args, \n \n b", | 4871 "a, ... args, \n \n b", |
| 4867 "a, a, ...args", | 4872 "a, a, ...args", |
| 4868 "a,\ta, ...args", | 4873 "a,\ta, ...args", |
| 4869 "a,\ra, ...args", | 4874 "a,\ra, ...args", |
| 4870 "a,\na, ...args", | 4875 "a,\na, ...args", |
| 4871 NULL}; | 4876 NULL}; |
| 4872 static const ParserFlag always_flags[] = {kAllowHarmonyRestParameters}; | 4877 static const ParserFlag always_flags[] = |
| 4878 {kAllowHarmonyRestParameters, kAllowHarmonyArrowFunctions}; |
| 4873 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | 4879 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |
| 4874 arraysize(always_flags)); | 4880 arraysize(always_flags)); |
| 4875 } | 4881 } |
| 4876 | 4882 |
| 4877 | 4883 |
| 4878 TEST(RestParametersEvalArguments) { | 4884 TEST(RestParametersEvalArguments) { |
| 4879 const char* strict_context_data[][2] = | 4885 const char* strict_context_data[][2] = |
| 4880 {{"'use strict';(function(", | 4886 {{"'use strict';(function(", |
| 4881 "){ return;})(1, [], /regexp/, 'str',function(){});"}, | 4887 "){ return;})(1, [], /regexp/, 'str',function(){});"}, |
| 4882 {NULL, NULL}}; | 4888 {NULL, NULL}}; |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5546 static const ParserFlag always_flags[] = { | 5552 static const ParserFlag always_flags[] = { |
| 5547 kAllowStrongMode, kAllowHarmonyScoping | 5553 kAllowStrongMode, kAllowHarmonyScoping |
| 5548 }; | 5554 }; |
| 5549 RunParserSyncTest(sloppy_context_data, data, kSuccess, NULL, 0, always_flags, | 5555 RunParserSyncTest(sloppy_context_data, data, kSuccess, NULL, 0, always_flags, |
| 5550 arraysize(always_flags)); | 5556 arraysize(always_flags)); |
| 5551 RunParserSyncTest(strict_context_data, data, kSuccess, NULL, 0, always_flags, | 5557 RunParserSyncTest(strict_context_data, data, kSuccess, NULL, 0, always_flags, |
| 5552 arraysize(always_flags)); | 5558 arraysize(always_flags)); |
| 5553 RunParserSyncTest(strong_context_data, data, kError, NULL, 0, always_flags, | 5559 RunParserSyncTest(strong_context_data, data, kError, NULL, 0, always_flags, |
| 5554 arraysize(always_flags)); | 5560 arraysize(always_flags)); |
| 5555 } | 5561 } |
| OLD | NEW |