test262-automation e9a5a7f918 [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) (#1620)
* [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)
2018-07-03 15:59:58 -04:00

38 lines
1.1 KiB
JavaScript

var assert = function (result, expected, message) {
if (result !== expected) {
throw new Error('Error in assert. Expected "' + expected + '" but was "' + result + '":' + message );
}
};
var assertThrow = function (cb, expected) {
let error = null;
try {
cb();
} catch(e) {
error = e;
}
if (error === null) {
throw new Error('Error is expected. Expected "' + expected + '" but error was not thrown."');
}
if (error.toString() !== expected) {
throw new Error('Error is expected. Expected "' + expected + '" but error was "' + error + '"');
}
};
var foo = 'foo';
var success = false;
// FIXME: According to spec foo should have value 'undefined',
// but possible it would be changed https://github.com/tc39/ecma262/issues/753
eval("success = foo === 'foo'; { function foo(){} }");
assert(success, true);
success = false;
let boo = 'boo';
eval("success = boo === 'boo'; { function boo(){} } success = success && boo === 'boo';");
success = success && boo === 'boo';
assert(success, true);