Replace runTestCase with assert helpers [test/built-ins/Function]

This commit is contained in:
André Bargull 2015-08-06 18:24:22 +02:00
parent b1ecdd00e8
commit 60a2879133
70 changed files with 117 additions and 415 deletions

View File

@ -6,12 +6,6 @@ es5id: 15.3.2.1-11-1
description: >
Duplicate separate parameter name in Function constructor allowed
if body not strict
includes: [runTestCase.js]
---*/
function testcase()
{
Function('a','a','return;');
return true;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 15.3.2.1-11-3
description: >
Function constructor may have a formal parameter named 'eval' if
body is not strict mode
includes: [runTestCase.js]
---*/
function testcase() {
Function('eval', 'return;');
return true;
}
runTestCase(testcase);

View File

@ -6,12 +6,6 @@ es5id: 15.3.2.1-11-5
description: >
Duplicate combined parameter name in Function constructor allowed
if body is not strict
includes: [runTestCase.js]
---*/
function testcase()
{
Function('a,a','return;');
return true;
}
runTestCase(testcase);

View File

@ -9,13 +9,6 @@ description: >
which are separated by a unique parameter name and there is no
explicit 'use strict' in the function constructor's body
flags: [onlyStrict]
includes: [runTestCase.js]
---*/
function testcase() {
var foo = new Function("baz", "qux", "baz", "return 0;");
return true;
}
runTestCase(testcase);

View File

@ -8,11 +8,6 @@ description: >
the Function constructor that has three identical parameters and
there is no explicit 'use strict' in the function constructor's
body
includes: [runTestCase.js]
---*/
function testcase() {
var foo = new Function("baz", "baz", "baz", "return 0;");
return true;
}
runTestCase(testcase);

View File

@ -4,17 +4,11 @@
/*---
es5id: 15.3.3.2-1
description: Function.length - data property with value 1
includes: [runTestCase.js]
---*/
function testcase() {
var desc = Object.getOwnPropertyDescriptor(Function,"length");
if(desc.value === 1 &&
desc.writable === false &&
desc.enumerable === false &&
desc.configurable === true)
return true;
}
runTestCase(testcase);
assert.sameValue(desc.value, 1, 'desc.value');
assert.sameValue(desc.writable, false, 'desc.writable');
assert.sameValue(desc.enumerable, false, 'desc.enumerable');
assert.sameValue(desc.configurable, true, 'desc.configurable');

View File

@ -8,13 +8,10 @@ description: >
to wrapper objects when the function is called with an array of
arguments
flags: [onlyStrict]
includes: [runTestCase.js]
---*/
function testcase() {
function fun() {
return (this instanceof String);
}
return !fun.apply("", Array);
}
runTestCase(testcase);
assert.sameValue(fun.apply("", Array), false, 'fun.apply("", Array)');

View File

@ -8,13 +8,10 @@ description: >
to wrapper objects when the function is called with an array of
arguments
flags: [onlyStrict]
includes: [runTestCase.js]
---*/
function testcase() {
function fun() {
return (this instanceof Number);
}
return !fun.apply(-12, Array);
}
runTestCase(testcase);
assert.sameValue(fun.apply(-12, Array), false, 'fun.apply(-12, Array)');

View File

@ -8,13 +8,10 @@ description: >
to wrapper objects when the function is called with an array of
arguments
flags: [onlyStrict]
includes: [runTestCase.js]
---*/
function testcase() {
function fun() {
return (this instanceof Boolean);
}
return !fun.apply(false, Array);
}
runTestCase(testcase);
assert.sameValue(fun.apply(false, Array), false, 'fun.apply(false, Array)');

View File

@ -4,14 +4,8 @@
/*---
es5id: 15.3.4.5-0-1
description: Function.prototype.bind must exist as a function
includes: [runTestCase.js]
---*/
function testcase() {
var f = Function.prototype.bind;
if (typeof(f) === "function") {
return true;
}
}
runTestCase(testcase);
assert.sameValue(typeof(f), "function", 'typeof(f)');

View File

@ -4,12 +4,6 @@
/*---
es5id: 15.3.4.5-0-2
description: Function.prototype.bind must exist as a function taking 1 parameter
includes: [runTestCase.js]
---*/
function testcase() {
if (Function.prototype.bind.length === 1) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(Function.prototype.bind.length, 1, 'Function.prototype.bind.length');

View File

@ -6,14 +6,10 @@ es5id: 15.3.4.5-10-1
description: >
Function.prototype.bind - internal property [[Class]] of 'F' is
set as Function
includes: [runTestCase.js]
---*/
function testcase() {
var foo = function () { };
var obj = foo.bind({});
return Object.prototype.toString.call(obj) === "[object Function]";
}
runTestCase(testcase);
assert.sameValue(Object.prototype.toString.call(obj), "[object Function]", 'Object.prototype.toString.call(obj)');

View File

@ -4,16 +4,11 @@
/*---
es5id: 15.3.4.5-13.b-1
description: Function.prototype.bind, bound fn has a 'length' own property
includes: [runTestCase.js]
---*/
function testcase() {
function foo() { }
var o = {};
var bf = foo.bind(o);
if (bf.hasOwnProperty('length')) {
return true;
}
}
runTestCase(testcase);
assert(bf.hasOwnProperty('length'), 'bf.hasOwnProperty("length") !== true');

View File

@ -6,16 +6,11 @@ es5id: 15.3.4.5-13.b-2
description: >
Function.prototype.bind, 'length' set to remaining number of
expected args
includes: [runTestCase.js]
---*/
function testcase() {
function foo(x, y) { }
var o = {};
var bf = foo.bind(o);
if (bf.length === 2) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(bf.length, 2, 'bf.length');

View File

@ -6,16 +6,11 @@ es5id: 15.3.4.5-13.b-3
description: >
Function.prototype.bind, 'length' set to remaining number of
expected args (all args prefilled)
includes: [runTestCase.js]
---*/
function testcase() {
function foo(x, y) { }
var o = {};
var bf = foo.bind(o, 42, 101);
if (bf.length === 0) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(bf.length, 0, 'bf.length');

View File

@ -6,16 +6,11 @@ es5id: 15.3.4.5-13.b-4
description: >
Function.prototype.bind, 'length' set to remaining number of
expected args (target takes 0 args)
includes: [runTestCase.js]
---*/
function testcase() {
function foo() { }
var o = {};
var bf = foo.bind(o);
if (bf.length === 0) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(bf.length, 0, 'bf.length');

View File

@ -6,16 +6,11 @@ es5id: 15.3.4.5-13.b-5
description: >
Function.prototype.bind, 'length' set to remaining number of
expected args (target provided extra args)
includes: [runTestCase.js]
---*/
function testcase() {
function foo() { }
var o = {};
var bf = foo.bind(o, 42);
if (bf.length === 0) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(bf.length, 0, 'bf.length');

View File

@ -6,16 +6,11 @@ es5id: 15.3.4.5-13.b-6
description: >
Function.prototype.bind, 'length' set to remaining number of
expected args
includes: [runTestCase.js]
---*/
function testcase() {
function foo(x, y) { }
var o = {};
var bf = foo.bind(o, 42);
if (bf.length === 1) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(bf.length, 1, 'bf.length');

View File

@ -4,19 +4,14 @@
/*---
es5id: 15.3.4.5-15-1
description: Function.prototype.bind, 'length' is a data valued own property
includes: [runTestCase.js]
---*/
function testcase() {
function foo() { }
var o = {};
var bf = foo.bind(o);
var desc = Object.getOwnPropertyDescriptor(bf, 'length');
if (desc.hasOwnProperty('value') === true &&
desc.hasOwnProperty('get') === false &&
desc.hasOwnProperty('set') === false) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(desc.hasOwnProperty('value'), true, 'desc.hasOwnProperty("value")');
assert.sameValue(desc.hasOwnProperty('get'), false, 'desc.hasOwnProperty("get")');
assert.sameValue(desc.hasOwnProperty('set'), false, 'desc.hasOwnProperty("set")');

View File

@ -5,20 +5,15 @@
es5id: 15.3.4.5-15-2
description: >
Function.prototype.bind, 'length' is a data valued own property
includes: [runTestCase.js]
---*/
function testcase() {
function foo() { }
var o = {};
var bf = foo.bind(o);
var desc = Object.getOwnPropertyDescriptor(bf, 'length');
if (desc.value === 0 &&
desc.enumerable === false &&
desc.writable === false &&
desc.configurable == true) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(desc.value, 0, 'desc.value');
assert.sameValue(desc.enumerable, false, 'desc.enumerable');
assert.sameValue(desc.writable, false, 'desc.writable');
assert.sameValue(desc.configurable, true, 'desc.configurable');

View File

@ -6,11 +6,8 @@ es5id: 15.3.4.5-15-4
description: >
Function.prototype.bind - The [[Enumerable]] attribute of length
property in F set as false
includes: [runTestCase.js]
---*/
function testcase() {
var canEnumerable = false;
var hasProperty = false;
function foo() { }
@ -21,6 +18,6 @@ function testcase() {
canEnumerable = true;
}
}
return hasProperty && !canEnumerable;
}
runTestCase(testcase);
assert(hasProperty, 'hasProperty !== true');
assert.sameValue(canEnumerable, false, 'canEnumerable');

View File

@ -6,11 +6,8 @@ es5id: 15.3.4.5-15-5
description: >
Function.prototype.bind - The [[Configurable]] attribute of length
property in F set as false
includes: [runTestCase.js]
---*/
function testcase() {
var canConfigurable = false;
var hasProperty = false;
function foo() { }
@ -18,6 +15,6 @@ function testcase() {
hasProperty = obj.hasOwnProperty("length");
delete obj.caller;
canConfigurable = !obj.hasOwnProperty("length");
return hasProperty && !canConfigurable;
}
runTestCase(testcase);
assert(hasProperty, 'hasProperty !== true');
assert.sameValue(canConfigurable, false, 'canConfigurable');

View File

@ -4,17 +4,12 @@
/*---
es5id: 15.3.4.5-16-1
description: Function.prototype.bind, [[Extensible]] of the bound fn is true
includes: [runTestCase.js]
---*/
function testcase() {
function foo() { }
var o = {};
var bf = foo.bind(o);
var ex = Object.isExtensible(bf);
if (ex === true) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(ex, true, 'ex');

View File

@ -6,14 +6,10 @@ es5id: 15.3.4.5-16-2
description: >
Function.prototype.bind - The [[Extensible]] attribute of internal
property in F set as true
includes: [runTestCase.js]
---*/
function testcase() {
function foo() { }
var obj = foo.bind({});
obj.property = 12;
return obj.hasOwnProperty("property");
}
runTestCase(testcase);
assert(obj.hasOwnProperty("property"), 'obj.hasOwnProperty("property") !== true');

View File

@ -7,14 +7,9 @@ info: >
is not callable.
es5id: 15.3.4.5-2-3
description: Function.prototype.bind allows Target to be a constructor (Number)
includes: [runTestCase.js]
---*/
function testcase() {
var bnc = Number.bind(null);
var n = bnc(42);
if (n === 42) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(n, 42, 'n');

View File

@ -7,14 +7,9 @@ info: >
is not callable.
es5id: 15.3.4.5-2-4
description: Function.prototype.bind allows Target to be a constructor (String)
includes: [runTestCase.js]
---*/
function testcase() {
var bsc = String.bind(null);
var s = bsc("hello world");
if (s === "hello world") {
return true;
}
}
runTestCase(testcase);
assert.sameValue(s, "hello world", 's');

View File

@ -7,14 +7,9 @@ info: >
is not callable.
es5id: 15.3.4.5-2-5
description: Function.prototype.bind allows Target to be a constructor (Boolean)
includes: [runTestCase.js]
---*/
function testcase() {
var bbc = Boolean.bind(null);
var b = bbc(true);
if (b === true) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(b, true, 'b');

View File

@ -7,14 +7,9 @@ info: >
is not callable.
es5id: 15.3.4.5-2-6
description: Function.prototype.bind allows Target to be a constructor (Object)
includes: [runTestCase.js]
---*/
function testcase() {
var boc = Object.bind(null);
var o = boc(42);
if (o == 42) {
return true;
}
}
runTestCase(testcase);
assert((o == 42), '(o == 42) !== true');

View File

@ -7,15 +7,13 @@ info: >
is not callable.
es5id: 15.3.4.5-2-8
description: Function.prototype.bind allows Target to be a constructor (Array)
includes: [runTestCase.js]
---*/
function testcase() {
var bac = Array.bind(null);
var a = bac(42);
a.prop = "verifyPropertyExist";
a[41] = 41;
return a.prop === "verifyPropertyExist" && a[41] === 41 && a.length === 42;
}
runTestCase(testcase);
assert.sameValue(a.prop, "verifyPropertyExist", 'a.prop');
assert.sameValue(a[41], 41, 'a[41]');
assert.sameValue(a.length, 42, 'a.length');

View File

@ -4,14 +4,9 @@
/*---
es5id: 15.3.4.5-2-9
description: Function.prototype.bind allows Target to be a constructor (Date)
includes: [runTestCase.js]
---*/
function testcase() {
var bdc = Date.bind(null);
var s = bdc(0, 0, 0);
if (typeof(s) === 'string') {
return true;
}
}
runTestCase(testcase);
assert.sameValue(typeof(s), 'string', 'typeof(s)');

View File

@ -4,17 +4,13 @@
/*---
es5id: 15.3.4.5-3-1
description: Function.prototype.bind - each arg is defined in A in list order
includes: [runTestCase.js]
---*/
function testcase() {
var foo = function (x, y) {
return new Boolean((x + y) === "ab" && arguments[0] === "a" &&
arguments[1] === "b" && arguments.length === 2);
};
var obj = foo.bind({}, "a", "b");
return obj()==true;
}
runTestCase(testcase);
assert((obj() == true), '(obj() == true) !== true');

View File

@ -4,15 +4,11 @@
/*---
es5id: 15.3.4.5-6-1
description: Function.prototype.bind - F can get own data property
includes: [runTestCase.js]
---*/
function testcase() {
var foo = function () { };
var obj = foo.bind({});
obj.property = 12;
return obj.property === 12;
}
runTestCase(testcase);
assert.sameValue(obj.property, 12, 'obj.property');

View File

@ -4,14 +4,10 @@
/*---
es5id: 15.3.4.5-6-12
description: Function.prototype.bind - F cannot get property which doesn't exist
includes: [runTestCase.js]
---*/
function testcase() {
var foo = function () { };
var obj = foo.bind({});
return typeof (obj.property) === "undefined";
}
runTestCase(testcase);
assert.sameValue(typeof (obj.property), "undefined", 'typeof (obj.property)');

View File

@ -4,11 +4,8 @@
/*---
es5id: 15.3.4.5-6-5
description: Function.prototype.bind - F can get own accessor property
includes: [runTestCase.js]
---*/
function testcase() {
var foo = function () { };
var obj = foo.bind({});
@ -17,6 +14,5 @@ function testcase() {
return 12;
}
});
return obj.property === 12;
}
runTestCase(testcase);
assert.sameValue(obj.property, 12, 'obj.property');

View File

@ -6,17 +6,14 @@ es5id: 15.3.4.5-6-9
description: >
Function.prototype.bind - F can get own accessor property without
a get function
includes: [runTestCase.js]
---*/
function testcase() {
var foo = function () { };
var obj = foo.bind({});
Object.defineProperty(obj, "property", {
set: function () {}
});
return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined";
}
runTestCase(testcase);
assert(obj.hasOwnProperty("property"), 'obj.hasOwnProperty("property") !== true');
assert.sameValue(typeof (obj.property), "undefined", 'typeof (obj.property)');

View File

@ -4,16 +4,11 @@
/*---
es5id: 15.3.4.5-8-1
description: Function.prototype.bind, type of bound function must be 'function'
includes: [runTestCase.js]
---*/
function testcase() {
function foo() { }
var o = {};
var bf = foo.bind(o);
if (typeof(bf) === 'function') {
return true;
}
}
runTestCase(testcase);
assert.sameValue(typeof(bf), 'function', 'typeof(bf)');

View File

@ -6,17 +6,12 @@ es5id: 15.3.4.5-8-2
description: >
Function.prototype.bind, [[Class]] of bound function must be
'Function'
includes: [runTestCase.js]
---*/
function testcase() {
function foo() { }
var o = {};
var bf = foo.bind(o);
var s = Object.prototype.toString.call(bf);
if (s === '[object Function]') {
return true;
}
}
runTestCase(testcase);
assert.sameValue(s, '[object Function]', 's');

View File

@ -4,16 +4,11 @@
/*---
es5id: 15.3.4.5-9-1
description: Function.prototype.bind, [[Prototype]] is Function.prototype
includes: [runTestCase.js]
---*/
function testcase() {
function foo() { }
var o = {};
var bf = foo.bind(o);
if (Function.prototype.isPrototypeOf(bf)) {
return true;
}
}
runTestCase(testcase);
assert(Function.prototype.isPrototypeOf(bf), 'Function.prototype.isPrototypeOf(bf) !== true');

View File

@ -6,16 +6,11 @@ es5id: 15.3.4.5-9-2
description: >
Function.prototype.bind, [[Prototype]] is Function.prototype
(using getPrototypeOf)
includes: [runTestCase.js]
---*/
function testcase() {
function foo() { }
var o = {};
var bf = foo.bind(o);
if (Object.getPrototypeOf(bf) === Function.prototype) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(Object.getPrototypeOf(bf), Function.prototype, 'Object.getPrototypeOf(bf)');

View File

@ -7,16 +7,12 @@ description: >
[[Call]] - 'F''s [[BoundArgs]] is used as the former part of
arguments of calling the [[Call]] internal method of 'F''s
[[TargetFunction]] when 'F' is called
includes: [runTestCase.js]
---*/
function testcase() {
var func = function (x, y, z) {
return x + y + z;
};
var newFunc = Function.prototype.bind.call(func, {}, "a", "b", "c");
return newFunc() === "abc";
}
runTestCase(testcase);
assert.sameValue(newFunc(), "abc", 'newFunc()');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.1-4-10
description: >
[[Call]] - length of parameters of 'target' is 1, length of
'boundArgs' is 0, length of 'ExtraArgs' is 0, and with 'boundThis'
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { prop: "abc" };
var func = function (x) {
@ -18,6 +16,4 @@ function testcase() {
var newFunc = Function.prototype.bind.call(func, obj);
return newFunc();
}
runTestCase(testcase);
assert(newFunc(), 'newFunc() !== true');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.1-4-11
description: >
[[Call]] - length of parameters of 'target' is 1, length of
'boundArgs' is 0, length of 'ExtraArgs' is 1, and with 'boundThis'
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { prop: "abc" };
var func = function (x) {
@ -18,6 +16,4 @@ function testcase() {
var newFunc = Function.prototype.bind.call(func, obj);
return newFunc(1);
}
runTestCase(testcase);
assert(newFunc(1), 'newFunc(1) !== true');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.1-4-12
description: >
[[Call]] - length of parameters of 'target' is 1, length of
'boundArgs' is 0, length of 'ExtraArgs' is 2, and with 'boundThis'
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { prop: "abc" };
var func = function (x) {
@ -19,6 +17,4 @@ function testcase() {
var newFunc = Function.prototype.bind.call(func, obj);
return newFunc(1, 2);
}
runTestCase(testcase);
assert(newFunc(1, 2), 'newFunc(1, 2) !== true');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.1-4-13
description: >
[[Call]] - length of parameters of 'target' is 1, length of
'boundArgs' is 1, length of 'ExtraArgs' is 0, and with 'boundThis'
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { prop: "abc" };
var func = function (x) {
@ -19,6 +17,4 @@ function testcase() {
var newFunc = Function.prototype.bind.call(func, obj, 1);
return newFunc();
}
runTestCase(testcase);
assert(newFunc(), 'newFunc() !== true');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.1-4-14
description: >
[[Call]] - length of parameters of 'target' is 1, length of
'boundArgs' is 1, length of 'ExtraArgs' is 1, and with 'boundThis'
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { prop: "abc" };
var func = function (x) {
@ -19,6 +17,4 @@ function testcase() {
var newFunc = Function.prototype.bind.call(func, obj, 1);
return newFunc(2);
}
runTestCase(testcase);
assert(newFunc(2), 'newFunc(2) !== true');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.1-4-15
description: >
[[Call]] - length of parameters of 'target' is 1, length of
'boundArgs' is 2, length of 'ExtraArgs' is 0, and with 'boundThis'
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { prop: "abc" };
var func = function (x) {
@ -19,6 +17,4 @@ function testcase() {
var newFunc = Function.prototype.bind.call(func, obj, 1, 2);
return newFunc();
}
runTestCase(testcase);
assert(newFunc(), 'newFunc() !== true');

View File

@ -7,10 +7,8 @@ description: >
[[Call]] - 'F''s [[BoundThis]] is used as the 'this' value of
calling the [[Call]] internal method of 'F''s [[TargetFunction]]
when 'F' is called
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { "prop": "a" };
var func = function () {
@ -19,6 +17,4 @@ function testcase() {
var newFunc = Function.prototype.bind.call(func, obj);
return newFunc() === obj;
}
runTestCase(testcase);
assert.sameValue(newFunc(), obj, 'newFunc()');

View File

@ -7,16 +7,12 @@ description: >
[[Call]] - the provided arguments is used as the latter part of
arguments of calling the [[Call]] internal method of 'F''s
[[TargetFunction]] when 'F' is called
includes: [runTestCase.js]
---*/
function testcase() {
var func = function (x, y, z) {
return z;
};
var newFunc = Function.prototype.bind.call(func, {}, "a", "b");
return newFunc("c") === "c";
}
runTestCase(testcase);
assert.sameValue(newFunc("c"), "c", 'newFunc("c")');

View File

@ -7,16 +7,12 @@ description: >
[[Call]] - length of parameters of 'target' is 0, length of
'boundArgs' is 0, length of 'ExtraArgs' is 0, and without
'boundThis'
includes: [runTestCase.js]
---*/
function testcase() {
var func = function () {
return arguments.length === 0;
};
var newFunc = Function.prototype.bind.call(func);
return newFunc();
}
runTestCase(testcase);
assert(newFunc(), 'newFunc() !== true');

View File

@ -7,16 +7,12 @@ description: >
[[Call]] - length of parameters of 'target' is 0, length of
'boundArgs' is 0, length of 'ExtraArgs' is 1, and without
'boundThis'
includes: [runTestCase.js]
---*/
function testcase() {
var func = function () {
return arguments[0] === 1;
};
var newFunc = Function.prototype.bind.call(func);
return newFunc(1);
}
runTestCase(testcase);
assert(newFunc(1), 'newFunc(1) !== true');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.1-4-6
description: >
[[Call]] - length of parameters of 'target' is 0, length of
'boundArgs' is 0, length of 'ExtraArgs' is 0, and with 'boundThis'
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { prop: "abc" };
var func = function () {
@ -18,6 +16,4 @@ function testcase() {
var newFunc = Function.prototype.bind.call(func, obj);
return newFunc();
}
runTestCase(testcase);
assert(newFunc(), 'newFunc() !== true');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.1-4-7
description: >
[[Call]] - length of parameters of 'target' is 0, length of
'boundArgs' is 1, length of 'ExtraArgs' is 0, and with 'boundThis'
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { prop: "abc" };
var func = function () {
@ -18,6 +16,4 @@ function testcase() {
var newFunc = Function.prototype.bind.call(func, obj, 1);
return newFunc();
}
runTestCase(testcase);
assert(newFunc(), 'newFunc() !== true');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.1-4-8
description: >
[[Call]] - length of parameters of 'target' is 0, length of
'boundArgs' is 0, length of 'ExtraArgs' is 1, and with 'boundThis'
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { prop: "abc" };
var func = function () {
@ -18,6 +16,4 @@ function testcase() {
var newFunc = Function.prototype.bind.call(func, obj);
return newFunc(1);
}
runTestCase(testcase);
assert(newFunc(1), 'newFunc(1) !== true');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.1-4-9
description: >
[[Call]] - length of parameters of 'target' is 0, length of
'boundArgs' is 1, length of 'ExtraArgs' is 1, and with 'boundThis'
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { prop: "abc" };
var func = function () {
@ -18,6 +16,4 @@ function testcase() {
var newFunc = Function.prototype.bind.call(func, obj, 1);
return newFunc(2);
}
runTestCase(testcase);
assert(newFunc(2), 'newFunc(2) !== true');

View File

@ -7,10 +7,8 @@ description: >
[[Construct]] - 'F''s [[BoundArgs]] is used as the former part of
arguments of calling the [[Construct]] internal method of 'F''s
[[TargetFunction]] when 'F' is called as constructor
includes: [runTestCase.js]
---*/
function testcase() {
var func = function (x, y, z) {
var objResult = {};
objResult.returnValue = x + y + z;
@ -22,7 +20,7 @@ function testcase() {
var newInstance = new NewFunc();
return newInstance.hasOwnProperty("returnValue") && newInstance.returnValue === "abc" &&
newInstance.hasOwnProperty("returnVerifyResult") && newInstance.returnVerifyResult === true;
}
runTestCase(testcase);
assert(newInstance.hasOwnProperty("returnValue"), 'newInstance.hasOwnProperty("returnValue") !== true');
assert.sameValue(newInstance.returnValue, "abc", 'newInstance.returnValue');
assert(newInstance.hasOwnProperty("returnVerifyResult"), 'newInstance.hasOwnProperty("returnVerifyResult") !== true');
assert.sameValue(newInstance.returnVerifyResult, true, 'newInstance.returnVerifyResult');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.2-4-10
description: >
[[Construct]] - length of parameters of 'target' is 1, length of
'boundArgs' is 0, length of 'ExtraArgs' is 1
includes: [runTestCase.js]
---*/
function testcase() {
var func = function (x) {
return new Boolean(arguments.length === 1 && x === 1 && arguments[0] === 1);
};
@ -18,6 +16,4 @@ function testcase() {
var newInstance = new NewFunc(1);
return newInstance.valueOf() === true;
}
runTestCase(testcase);
assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.2-4-11
description: >
[[Construct]] - length of parameters of 'target' is 1, length of
'boundArgs' is 0, length of 'ExtraArgs' is 2
includes: [runTestCase.js]
---*/
function testcase() {
var func = function (x) {
return new Boolean(arguments.length === 2 && x === 1 && arguments[1] === 2 && arguments[0] === 1);
};
@ -18,6 +16,4 @@ function testcase() {
var newInstance = new NewFunc(1, 2);
return newInstance.valueOf() === true;
}
runTestCase(testcase);
assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.2-4-12
description: >
[[Construct]] - length of parameters of 'target' is 1, length of
'boundArgs' is 1, length of 'ExtraArgs' is 0
includes: [runTestCase.js]
---*/
function testcase() {
var func = function (x) {
return new Boolean(arguments.length === 1 && x === 1 && arguments[0] === 1);
};
@ -18,6 +16,4 @@ function testcase() {
var newInstance = new NewFunc();
return newInstance.valueOf() === true;
}
runTestCase(testcase);
assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.2-4-13
description: >
[[Construct]] - length of parameters of 'target' is 1, length of
'boundArgs' is 1, length of 'ExtraArgs' is 1
includes: [runTestCase.js]
---*/
function testcase() {
var func = function (x) {
return new Boolean(arguments.length === 2 && x === 1 && arguments[1] === 2 && arguments[0] === 1);
};
@ -18,6 +16,4 @@ function testcase() {
var newInstance = new NewFunc(2);
return newInstance.valueOf() === true;
}
runTestCase(testcase);
assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.2-4-14
description: >
[[Construct]] - length of parameters of 'target' is 1, length of
'boundArgs' is 2, length of 'ExtraArgs' is 0
includes: [runTestCase.js]
---*/
function testcase() {
var func = function (x) {
return new Boolean(arguments.length === 2 && x === 1 && arguments[1] === 2 && arguments[0] === 1);
};
@ -18,6 +16,4 @@ function testcase() {
var newInstance = new NewFunc();
return newInstance.valueOf() === true;
}
runTestCase(testcase);
assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');

View File

@ -7,10 +7,8 @@ description: >
[[Construct]] - the provided arguments is used as the latter part
of arguments of calling the [[Construct]] internal method of 'F''s
[[TargetFunction]] when 'F' is called as constructor
includes: [runTestCase.js]
---*/
function testcase() {
var func = function (x, y, z) {
var objResult = {};
objResult.returnValue = x + y + z;
@ -22,7 +20,7 @@ function testcase() {
var newInstance = new NewFunc("a", "b", "c");
return newInstance.hasOwnProperty("returnValue") && newInstance.returnValue === "abc" &&
newInstance.hasOwnProperty("returnVerifyResult") && newInstance.returnVerifyResult === true;
}
runTestCase(testcase);
assert(newInstance.hasOwnProperty("returnValue"), 'newInstance.hasOwnProperty("returnValue") !== true');
assert.sameValue(newInstance.returnValue, "abc", 'newInstance.returnValue');
assert(newInstance.hasOwnProperty("returnVerifyResult"), 'newInstance.hasOwnProperty("returnVerifyResult") !== true');
assert.sameValue(newInstance.returnVerifyResult, true, 'newInstance.returnVerifyResult');

View File

@ -7,10 +7,8 @@ description: >
[[Construct]] - length of parameters of 'target' is 0, length of
'boundArgs' is 0, length of 'ExtraArgs' is 0, and without
'boundThis'
includes: [runTestCase.js]
---*/
function testcase() {
var func = function () {
return new Boolean(arguments.length === 0);
};
@ -19,6 +17,4 @@ function testcase() {
var newInstance = new NewFunc();
return newInstance.valueOf() === true;
}
runTestCase(testcase);
assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');

View File

@ -7,10 +7,8 @@ description: >
[[Construct]] - length of parameters of 'target' is 0, length of
'boundArgs' is 0, length of 'ExtraArgs' is 1, and without
'boundThis'
includes: [runTestCase.js]
---*/
function testcase() {
var func = function () {
return new Boolean(arguments[0] === 1 && arguments.length === 1);
};
@ -19,6 +17,4 @@ function testcase() {
var newInstance = new NewFunc(1);
return newInstance.valueOf() === true;
}
runTestCase(testcase);
assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.2-4-6
description: >
[[Construct]] - length of parameters of 'target' is 0, length of
'boundArgs' is 1, length of 'ExtraArgs' is 0
includes: [runTestCase.js]
---*/
function testcase() {
var func = function () {
return new Boolean(arguments.length === 1 && arguments[0] === 1);
};
@ -18,6 +16,4 @@ function testcase() {
var newInstance = new NewFunc();
return newInstance.valueOf() === true;
}
runTestCase(testcase);
assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.2-4-7
description: >
[[Construct]] - length of parameters of 'target' is 0, length of
'boundArgs' is 0, length of 'ExtraArgs' is 1
includes: [runTestCase.js]
---*/
function testcase() {
var func = function () {
return new Boolean(arguments.length === 1 && arguments[0] === 1);
};
@ -18,6 +16,4 @@ function testcase() {
var newInstance = new NewFunc(1);
return newInstance.valueOf() === true;
}
runTestCase(testcase);
assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.2-4-8
description: >
[[Construct]] - length of parameters of 'target' is 0, length of
'boundArgs' is 1, length of 'ExtraArgs' is 1
includes: [runTestCase.js]
---*/
function testcase() {
var func = function () {
return new Boolean(arguments.length === 2 && arguments[0] === 1 && arguments[1] === 2);
};
@ -18,6 +16,4 @@ function testcase() {
var newInstance = new NewFunc(2);
return newInstance.valueOf() === true;
}
runTestCase(testcase);
assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');

View File

@ -6,10 +6,8 @@ es5id: 15.3.4.5.2-4-9
description: >
[[Construct]] - length of parameters of 'target' is 1, length of
'boundArgs' is 0, length of 'ExtraArgs' is 0
includes: [runTestCase.js]
---*/
function testcase() {
var func = function (x) {
return new Boolean(arguments.length === 0 && typeof x === "undefined");
};
@ -18,6 +16,4 @@ function testcase() {
var newInstance = new NewFunc();
return newInstance.valueOf() === true;
}
runTestCase(testcase);
assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');

View File

@ -8,13 +8,10 @@ description: >
to wrapper objects when the function is called without an array of
arguments
flags: [onlyStrict]
includes: [runTestCase.js]
---*/
function testcase() {
function fun() {
return (this instanceof String);
}
return !fun.call("");
}
runTestCase(testcase);
assert.sameValue(fun.call(""), false, 'fun.call("")');

View File

@ -8,13 +8,10 @@ description: >
to wrapper objects when the function is called without an array
argument
flags: [onlyStrict]
includes: [runTestCase.js]
---*/
function testcase() {
function fun() {
return (this instanceof Number);
}
return !fun.call(-12);
}
runTestCase(testcase);
assert.sameValue(fun.call(-12), false, 'fun.call(-12)');

View File

@ -8,13 +8,10 @@ description: >
to wrapper objects when the function is called without an array of
arguments
flags: [onlyStrict]
includes: [runTestCase.js]
---*/
function testcase() {
function fun() {
return (this instanceof Boolean);
}
return !fun.call(false);
}
runTestCase(testcase);
assert.sameValue(fun.call(false), false, 'fun.call(false)');