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

Side by Side Diff: test/mjsunit/strong/functions.js

Issue 1773653002: [strong] Remove all remainders of strong mode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Oversight Created 4 years, 9 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 | « test/mjsunit/strong/function-arity.js ('k') | test/mjsunit/strong/implicit-conversions.js » ('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 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --strong-mode
6
7 'use strong';
8
9 function f() {}
10 function* g() {}
11
12 (function NoArguments() {
13 assertThrows("'use strong'; arguments", SyntaxError);
14 assertThrows("'use strong'; function f() { arguments }", SyntaxError);
15 assertThrows("'use strong'; function* g() { arguments }", SyntaxError);
16 assertThrows("'use strong'; let f = function() { arguments }", SyntaxError);
17 assertThrows("'use strong'; let g = function*() { arguments }", SyntaxError);
18 assertThrows("'use strong'; let f = () => arguments", SyntaxError);
19 // The following are strict mode errors already.
20 assertThrows("'use strong'; let arguments", SyntaxError);
21 assertThrows("'use strong'; function f(arguments) {}", SyntaxError);
22 assertThrows("'use strong'; function* g(arguments) {}", SyntaxError);
23 assertThrows("'use strong'; let f = (arguments) => {}", SyntaxError);
24 })();
25
26 (function NoArgumentsProperty() {
27 assertFalse(f.hasOwnProperty("arguments"));
28 assertFalse(g.hasOwnProperty("arguments"));
29 assertThrows(function(){ f.arguments = 0 }, TypeError);
30 assertThrows(function(){ g.arguments = 0 }, TypeError);
31 })();
32
33 (function NoCaller() {
34 assertFalse(f.hasOwnProperty("caller"));
35 assertFalse(g.hasOwnProperty("caller"));
36 assertThrows(function(){ f.caller = 0 }, TypeError);
37 assertThrows(function(){ g.caller = 0 }, TypeError);
38 })();
39
40 (function NoCallee() {
41 assertFalse("callee" in f);
42 assertFalse("callee" in g);
43 assertThrows(function(){ f.callee = 0 }, TypeError);
44 assertThrows(function(){ g.callee = 0 }, TypeError);
45 })();
46
47 (function LexicalBindings(global) {
48 assertEquals('function', typeof f);
49 assertEquals('function', typeof g);
50 assertFalse(global.hasOwnProperty("f"));
51 assertFalse(global.hasOwnProperty("g"));
52 })(this);
53
54 (function ImmutableBindings() {
55 function f2() {}
56 function* g2() {}
57 assertThrows(function(){ f = 0 }, TypeError);
58 assertThrows(function(){ g = 0 }, TypeError);
59 assertThrows(function(){ f2 = 0 }, TypeError);
60 assertThrows(function(){ g2 = 0 }, TypeError);
61 assertEquals('function', typeof f);
62 assertEquals('function', typeof g);
63 assertEquals('function', typeof f2);
64 assertEquals('function', typeof g2);
65 })();
66
67 (function NonExtensible() {
68 assertThrows(function(){ f.a = 0 }, TypeError);
69 assertThrows(function(){ g.a = 0 }, TypeError);
70 assertThrows(function(){ Object.defineProperty(f, "a", {value: 0}) }, TypeErro r);
71 assertThrows(function(){ Object.defineProperty(g, "a", {value: 0}) }, TypeErro r);
72 assertThrows(function(){ Object.setPrototypeOf(f, {}) }, TypeError);
73 assertThrows(function(){ Object.setPrototypeOf(g, {}) }, TypeError);
74 })();
75
76 (function NoPrototype() {
77 assertFalse("prototype" in f);
78 assertFalse(g.hasOwnProperty("prototype"));
79 assertThrows(function(){ f.prototype = 0 }, TypeError);
80 assertThrows(function(){ g.prototype = 0 }, TypeError);
81 assertThrows(function(){ f.prototype.a = 0 }, TypeError);
82 })();
83
84 (function NonConstructor() {
85 assertThrows(function(){ new f }, TypeError);
86 assertThrows(function(){ new g }, TypeError);
87 })();
OLDNEW
« no previous file with comments | « test/mjsunit/strong/function-arity.js ('k') | test/mjsunit/strong/implicit-conversions.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698