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

Side by Side Diff: test/preparser/duplicate-parameter.pyt

Issue 7278039: Revert preparser duplicate detection. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/utils.h ('k') | test/preparser/duplicate-property.pyt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2011 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are
4 # met:
5 #
6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided
11 # with the distribution.
12 # * Neither the name of Google Inc. nor the names of its
13 # contributors may be used to endorse or promote products derived
14 # from this software without specific prior written permission.
15 #
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 # Templatated tests with duplicate parameter names.
29
30 # ----------------------------------------------------------------------
31 # Constants and utility functions
32
33 # A template that performs the same strict-mode test in different
34 # scopes (global scope, function scope, and nested function scope),
35 # and in non-strict mode too.
36 def DuplicateParameterTest(name, source):
37 expectation = "strict_param_dupe"
38 non_selfstrict = {"selfstrict":"", "id":"selfnormal"}
39
40 Template(name, '"use strict";\n' + source)(non_selfstrict, expectation)
41 Template(name + '-infunc',
42 'function foo() {\n "use strict";\n' + source +'\n}\n')(
43 non_selfstrict, expectation)
44 Template(name + '-infunc2',
45 'function foo() {\n "use strict";\n function bar() {\n' +
46 source +'\n }\n}\n')(non_selfstrict, expectation)
47
48 selfstrict = {"selfstrict": "\"use strict\";", "id": "selfstrict"}
49 nestedstrict = {"selfstrict": "function bar(){\"use strict\";}",
50 "id": "nestedstrict"}
51 selfstrictnestedclean = {"selfstrict": """
52 "use strict";
53 function bar(){}
54 """, "id": "selfstrictnestedclean"}
55 selftest = Template(name + '-$id', source)
56 selftest(selfstrict, expectation)
57 selftest(selfstrictnestedclean, expectation)
58 selftest(nestedstrict, None)
59 selftest(non_selfstrict, None)
60
61
62 # ----------------------------------------------------------------------
63 # Test templates
64
65 DuplicateParameterTest("dups", """
66 function foo(a, a) { $selfstrict }
67 """);
68
69 DuplicateParameterTest("dups-apart", """
70 function foo(a, b, c, d, e, f, g, h, i, j, k, l, m, n, a) { $selfstrict }
71 """);
72
73 DuplicateParameterTest("dups-escaped", """
74 function foo(\u0061, b, c, d, e, f, g, h, i, j, k, l, m, n, a) { $selfstrict }
75 """);
76
77 DuplicateParameterTest("triples", """
78 function foo(a, b, c, d, e, f, g, h, a, i, j, k, l, m, n, a) { $selfstrict }
79 """);
80
81 DuplicateParameterTest("escapes", """
82 function foo(a, \u0061) { $selfstrict }
83 """);
84
85 DuplicateParameterTest("long-names", """
86 function foo(arglebargleglopglyfarglebargleglopglyfarglebargleglopglyfa,
87 arglebargleglopglyfarglebargleglopglyfarglebargleglopglyfa) {
88 $selfstrict
89 }
90 """);
OLDNEW
« no previous file with comments | « src/utils.h ('k') | test/preparser/duplicate-property.pyt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698