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

Unified Diff: test/mjsunit/harmony/reflect-apply.js

Issue 1815773002: Remove runtime flags for Proxy and Reflect (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/harmony/reflect.js ('k') | test/mjsunit/harmony/reflect-construct.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/reflect-apply.js
diff --git a/test/mjsunit/harmony/reflect-apply.js b/test/mjsunit/harmony/reflect-apply.js
deleted file mode 100644
index 2cfb98282bbc21c5ef30f38183acefcb30142f47..0000000000000000000000000000000000000000
--- a/test/mjsunit/harmony/reflect-apply.js
+++ /dev/null
@@ -1,212 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Flags: --harmony-reflect
-
-
-(function testReflectApplyArity() {
- assertEquals(3, Reflect.apply.length);
-})();
-
-
-(function testReflectApplyNonConstructor() {
- assertThrows(function() {
- new Reflect.apply(function(){}, null, []);
- }, TypeError);
-})();
-
-
-(function testAppliedReceiverSloppy() {
- function returnThis() { return this; }
- var receiver = {};
-
- assertSame(this, Reflect.apply(returnThis, void 0, []));
- assertSame(this, Reflect.apply(returnThis, null, []));
- assertSame(this, Reflect.apply(returnThis, this, []));
- assertSame(receiver, Reflect.apply(returnThis, receiver, []));
-
- // Wrap JS values
- assertSame(String.prototype,
- Object.getPrototypeOf(Reflect.apply(returnThis, "str", [])));
- assertSame(Number.prototype,
- Object.getPrototypeOf(Reflect.apply(returnThis, 123, [])));
- assertSame(Boolean.prototype,
- Object.getPrototypeOf(Reflect.apply(returnThis, true, [])));
- assertSame(Symbol.prototype,
- Object.getPrototypeOf(
- Reflect.apply(returnThis, Symbol("test"), [])));
-})();
-
-
-(function testAppliedReceiverStrict() {
- function returnThis() { 'use strict'; return this; }
- var receiver = {};
-
- assertSame(void 0, Reflect.apply(returnThis, void 0, []));
- assertSame(this, Reflect.apply(returnThis, this, []));
- assertSame(receiver, Reflect.apply(returnThis, receiver, []));
-
- // Don't wrap value types
- var regexp = /123/;
- var symbol = Symbol("test");
- assertSame("str", Reflect.apply(returnThis, "str", []));
- assertSame(123, Reflect.apply(returnThis, 123, []));
- assertSame(true, Reflect.apply(returnThis, true, []));
- assertSame(regexp, Reflect.apply(returnThis, regexp, []));
- assertSame(symbol, Reflect.apply(returnThis, symbol, []));
-})();
-
-
-(function testAppliedArgumentsLength() {
- function returnLengthStrict() { 'use strict'; return arguments.length; }
- function returnLengthSloppy() { return arguments.length; }
-
- assertEquals(0, Reflect.apply(returnLengthStrict, this, []));
- assertEquals(0, Reflect.apply(returnLengthSloppy, this, []));
- assertEquals(0, Reflect.apply(returnLengthStrict, this, {}));
- assertEquals(0, Reflect.apply(returnLengthSloppy, this, {}));
-
- for (var i = 0; i < 256; ++i) {
- assertEquals(i, Reflect.apply(returnLengthStrict, this, new Array(i)));
- assertEquals(i, Reflect.apply(returnLengthSloppy, this, new Array(i)));
- assertEquals(i, Reflect.apply(returnLengthStrict, this, { length: i }));
- assertEquals(i, Reflect.apply(returnLengthSloppy, this, { length: i }));
- }
-})();
-
-
-(function testAppliedArgumentsLengthThrows() {
- function noopStrict() { 'use strict'; }
- function noopSloppy() { }
- function MyError() {}
-
- var argsList = {};
- Object.defineProperty(argsList, "length", {
- get: function() { throw new MyError(); }
- });
-
- assertThrows(function() {
- Reflect.apply(noopStrict, this, argsList);
- }, MyError);
-
- assertThrows(function() {
- Reflect.apply(noopSloppy, this, argsList);
- }, MyError);
-})();
-
-
-(function testAppliedArgumentsElementThrows() {
- function noopStrict() { 'use strict'; }
- function noopSloppy() { }
- function MyError() {}
-
- var argsList = { length: 1 };
- Object.defineProperty(argsList, "0", {
- get: function() { throw new MyError(); }
- });
-
- assertThrows(function() {
- Reflect.apply(noopStrict, this, argsList);
- }, MyError);
-
- assertThrows(function() {
- Reflect.apply(noopSloppy, this, argsList);
- }, MyError);
-})();
-
-
-(function testAppliedNonFunctionStrict() {
- 'use strict';
- assertThrows(function() { Reflect.apply(void 0); }, TypeError);
- assertThrows(function() { Reflect.apply(null); }, TypeError);
- assertThrows(function() { Reflect.apply(123); }, TypeError);
- assertThrows(function() { Reflect.apply("str"); }, TypeError);
- assertThrows(function() { Reflect.apply(Symbol("x")); }, TypeError);
- assertThrows(function() { Reflect.apply(/123/); }, TypeError);
- assertThrows(function() { Reflect.apply(NaN); }, TypeError);
- assertThrows(function() { Reflect.apply({}); }, TypeError);
- assertThrows(function() { Reflect.apply([]); }, TypeError);
-})();
-
-
-(function testAppliedNonFunctionSloppy() {
- assertThrows(function() { Reflect.apply(void 0); }, TypeError);
- assertThrows(function() { Reflect.apply(null); }, TypeError);
- assertThrows(function() { Reflect.apply(123); }, TypeError);
- assertThrows(function() { Reflect.apply("str"); }, TypeError);
- assertThrows(function() { Reflect.apply(Symbol("x")); }, TypeError);
- assertThrows(function() { Reflect.apply(/123/); }, TypeError);
- assertThrows(function() { Reflect.apply(NaN); }, TypeError);
- assertThrows(function() { Reflect.apply({}); }, TypeError);
- assertThrows(function() { Reflect.apply([]); }, TypeError);
-})();
-
-
-(function testAppliedArgumentsNonList() {
- function noopStrict() { 'use strict'; }
- function noopSloppy() {}
- var R = void 0;
- assertThrows(function() { Reflect.apply(noopStrict, R, null); }, TypeError);
- assertThrows(function() { Reflect.apply(noopSloppy, R, null); }, TypeError);
- assertThrows(function() { Reflect.apply(noopStrict, R, 1); }, TypeError);
- assertThrows(function() { Reflect.apply(noopSloppy, R, 1); }, TypeError);
- assertThrows(function() { Reflect.apply(noopStrict, R, "BAD"); }, TypeError);
- assertThrows(function() { Reflect.apply(noopSloppy, R, "BAD"); }, TypeError);
- assertThrows(function() { Reflect.apply(noopStrict, R, true); }, TypeError);
- assertThrows(function() { Reflect.apply(noopSloppy, R, true); }, TypeError);
- var sym = Symbol("x");
- assertThrows(function() { Reflect.apply(noopStrict, R, sym); }, TypeError);
- assertThrows(function() { Reflect.apply(noopSloppy, R, sym); }, TypeError);
-})();
-
-
-(function testAppliedArgumentValue() {
- function returnFirstStrict(a) { 'use strict'; return a; }
- function returnFirstSloppy(a) { return a; }
- function returnLastStrict(a) {
- 'use strict'; return arguments[arguments.length - 1]; }
- function returnLastSloppy(a) { return arguments[arguments.length - 1]; }
- function returnSumStrict() {
- 'use strict';
- var sum = arguments[0];
- for (var i = 1; i < arguments.length; ++i) {
- sum += arguments[i];
- }
- return sum;
- }
- function returnSumSloppy() {
- var sum = arguments[0];
- for (var i = 1; i < arguments.length; ++i) {
- sum += arguments[i];
- }
- return sum;
- }
-
- assertEquals("OK!", Reflect.apply(returnFirstStrict, this, ["OK!"]));
- assertEquals("OK!", Reflect.apply(returnFirstSloppy, this, ["OK!"]));
- assertEquals("OK!", Reflect.apply(returnFirstStrict, this,
- { 0: "OK!", length: 1 }));
- assertEquals("OK!", Reflect.apply(returnFirstSloppy, this,
- { 0: "OK!", length: 1 }));
- assertEquals("OK!", Reflect.apply(returnLastStrict, this,
- [0, 1, 2, 3, 4, 5, 6, 7, 8, "OK!"]));
- assertEquals("OK!", Reflect.apply(returnLastSloppy, this,
- [0, 1, 2, 3, 4, 5, 6, 7, 8, "OK!"]));
- assertEquals("OK!", Reflect.apply(returnLastStrict, this,
- { 9: "OK!", length: 10 }));
- assertEquals("OK!", Reflect.apply(returnLastSloppy, this,
- { 9: "OK!", length: 10 }));
- assertEquals("TEST", Reflect.apply(returnSumStrict, this,
- ["T", "E", "S", "T"]));
- assertEquals("TEST!!", Reflect.apply(returnSumStrict, this,
- ["T", "E", "S", "T", "!", "!"]));
- assertEquals(10, Reflect.apply(returnSumStrict, this,
- { 0: 1, 1: 2, 2: 3, 3: 4, length: 4 }));
- assertEquals("TEST", Reflect.apply(returnSumSloppy, this,
- ["T", "E", "S", "T"]));
- assertEquals("TEST!!", Reflect.apply(returnSumSloppy, this,
- ["T", "E", "S", "T", "!", "!"]));
- assertEquals(10, Reflect.apply(returnSumSloppy, this,
- { 0: 1, 1: 2, 2: 3, 3: 4, length: 4 }));
-})();
« no previous file with comments | « test/mjsunit/harmony/reflect.js ('k') | test/mjsunit/harmony/reflect-construct.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698