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

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

Issue 932833002: [strong] Deprecate delete (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase & merge conflicts 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
« no previous file with comments | « src/preparser.h ('k') | test/mjsunit/strong/delete.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 2873 matching lines...) Expand 10 before | Expand all | Expand 10 after
2884 }; 2884 };
2885 2885
2886 // The test is quite slow, so run it with a reduced set of flags. 2886 // The test is quite slow, so run it with a reduced set of flags.
2887 static const ParserFlag empty_flags[] = {kAllowLazy}; 2887 static const ParserFlag empty_flags[] = {kAllowLazy};
2888 RunParserSyncTest(context_data, statement_data, kError, empty_flags, 1); 2888 RunParserSyncTest(context_data, statement_data, kError, empty_flags, 1);
2889 } 2889 }
2890 2890
2891 2891
2892 TEST(StrictDelete) { 2892 TEST(StrictDelete) {
2893 // "delete <Identifier>" is not allowed in strict mode. 2893 // "delete <Identifier>" is not allowed in strict mode.
2894 const char* strict_context_data[][2] = { 2894 const char* strong_context_data[][2] = {
2895 {"\"use strict\"; ", ""},
2896 {"\"use strong\"; ", ""}, 2895 {"\"use strong\"; ", ""},
2897 { NULL, NULL } 2896 { NULL, NULL }
2898 }; 2897 };
2899 2898
2899 const char* strict_context_data[][2] = {
2900 {"\"use strict\"; ", ""},
2901 { NULL, NULL }
2902 };
2903
2900 const char* sloppy_context_data[][2] = { 2904 const char* sloppy_context_data[][2] = {
2901 {"", ""}, 2905 {"", ""},
2902 { NULL, NULL } 2906 { NULL, NULL }
2903 }; 2907 };
2904 2908
2905 // These are errors in the strict mode. 2909 // These are errors in the strict mode.
2906 const char* sloppy_statement_data[] = { 2910 const char* sloppy_statement_data[] = {
2907 "delete foo;", 2911 "delete foo;",
2908 "delete foo + 1;", 2912 "delete foo + 1;",
2909 "delete (foo);", 2913 "delete (foo);",
(...skipping 17 matching lines...) Expand all
2927 NULL 2931 NULL
2928 }; 2932 };
2929 2933
2930 // These are always errors 2934 // These are always errors
2931 const char* bad_statement_data[] = { 2935 const char* bad_statement_data[] = {
2932 "delete if;", 2936 "delete if;",
2933 NULL 2937 NULL
2934 }; 2938 };
2935 2939
2936 static const ParserFlag always_flags[] = {kAllowStrongMode}; 2940 static const ParserFlag always_flags[] = {kAllowStrongMode};
2941 RunParserSyncTest(strong_context_data, sloppy_statement_data, kError, NULL, 0,
2942 always_flags, arraysize(always_flags));
2937 RunParserSyncTest(strict_context_data, sloppy_statement_data, kError, NULL, 0, 2943 RunParserSyncTest(strict_context_data, sloppy_statement_data, kError, NULL, 0,
2938 always_flags, arraysize(always_flags)); 2944 always_flags, arraysize(always_flags));
2939 RunParserSyncTest(sloppy_context_data, sloppy_statement_data, kSuccess, NULL, 2945 RunParserSyncTest(sloppy_context_data, sloppy_statement_data, kSuccess, NULL,
2940 0, always_flags, arraysize(always_flags)); 2946 0, always_flags, arraysize(always_flags));
2941 2947
2948 RunParserSyncTest(strong_context_data, good_statement_data, kError, NULL, 0,
2949 always_flags, arraysize(always_flags));
2942 RunParserSyncTest(strict_context_data, good_statement_data, kSuccess, NULL, 0, 2950 RunParserSyncTest(strict_context_data, good_statement_data, kSuccess, NULL, 0,
2943 always_flags, arraysize(always_flags)); 2951 always_flags, arraysize(always_flags));
2944 RunParserSyncTest(sloppy_context_data, good_statement_data, kSuccess, NULL, 0, 2952 RunParserSyncTest(sloppy_context_data, good_statement_data, kSuccess, NULL, 0,
2945 always_flags, arraysize(always_flags)); 2953 always_flags, arraysize(always_flags));
2946 2954
2955 RunParserSyncTest(strong_context_data, bad_statement_data, kError, NULL, 0,
2956 always_flags, arraysize(always_flags));
2947 RunParserSyncTest(strict_context_data, bad_statement_data, kError, NULL, 0, 2957 RunParserSyncTest(strict_context_data, bad_statement_data, kError, NULL, 0,
2948 always_flags, arraysize(always_flags)); 2958 always_flags, arraysize(always_flags));
2949 RunParserSyncTest(sloppy_context_data, bad_statement_data, kError, NULL, 0, 2959 RunParserSyncTest(sloppy_context_data, bad_statement_data, kError, NULL, 0,
2950 always_flags, arraysize(always_flags)); 2960 always_flags, arraysize(always_flags));
2951 } 2961 }
2952 2962
2953 2963
2954 TEST(InvalidLeftHandSide) { 2964 TEST(InvalidLeftHandSide) {
2955 const char* assignment_context_data[][2] = { 2965 const char* assignment_context_data[][2] = {
2956 {"", " = 1;"}, 2966 {"", " = 1;"},
(...skipping 2543 matching lines...) Expand 10 before | Expand all | Expand 10 after
5500 always_flags, arraysize(always_flags)); 5510 always_flags, arraysize(always_flags));
5501 RunParserSyncTest(strict_context_data, let_declarations, kSuccess, NULL, 0, 5511 RunParserSyncTest(strict_context_data, let_declarations, kSuccess, NULL, 0,
5502 always_flags, arraysize(always_flags)); 5512 always_flags, arraysize(always_flags));
5503 5513
5504 RunParserSyncTest(sloppy_context_data, var_declarations, kSuccess, NULL, 0, 5514 RunParserSyncTest(sloppy_context_data, var_declarations, kSuccess, NULL, 0,
5505 always_flags, arraysize(always_flags)); 5515 always_flags, arraysize(always_flags));
5506 // At the moment, let declarations are only available in strict mode. 5516 // At the moment, let declarations are only available in strict mode.
5507 RunParserSyncTest(sloppy_context_data, let_declarations, kError, NULL, 0, 5517 RunParserSyncTest(sloppy_context_data, let_declarations, kError, NULL, 0,
5508 always_flags, arraysize(always_flags)); 5518 always_flags, arraysize(always_flags));
5509 } 5519 }
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | test/mjsunit/strong/delete.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698