mirror of
https://github.com/tc39/test262.git
synced 2025-05-03 22:40:28 +02:00
* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
28 lines
951 B
JavaScript
28 lines
951 B
JavaScript
var testCase = function (actual, expected, message) {
|
|
if (actual !== expected) {
|
|
throw message + ". Expected '" + expected + "', but was '" + actual + "'";
|
|
}
|
|
};
|
|
|
|
var simpleArrowFunction = () => {};
|
|
|
|
noInline(simpleArrowFunction);
|
|
|
|
function truthy() { return true; }
|
|
function falsey() { return false; }
|
|
noInline(truthy);
|
|
noInline(falsey);
|
|
|
|
for (var i=0;i<10000;i++) {
|
|
testCase(Object.getPrototypeOf(simpleArrowFunction), Function.prototype, "Error: Not correct getPrototypeOf value for arrow function");
|
|
|
|
testCase(simpleArrowFunction instanceof Function, true, "Error: Not correct result for instanceof method for arrow function");
|
|
|
|
testCase(simpleArrowFunction.constructor == Function, true, "Error: Not correct result for constructor method of arrow functio n");
|
|
|
|
let a1 = truthy() ? ()=>1 : ()=>2;
|
|
let a2 = falsey() ? ()=>2 : ()=>1;
|
|
testCase(a1(), 1, "Should be 1");
|
|
testCase(a2(), 1, "should be 1");
|
|
}
|