| 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, errorText) { |
| throw new Error('Expected error'); |
| throw new Error('Expected error ' + errorText + ' but was ' + error); |
| eval('{ function foo() {} }'); |
| assert(this.hasOwnProperty("foo"), true); |
| assert(typeof foo, 'function'); |
| Object.defineProperty(this, "globalNonWritable", { |
| eval("{function globalNonWritable() { return 1; }}"); |
| var globalNonWritableDescriptor |
| = Object.getOwnPropertyDescriptor(this, "globalNonWritable"); |
| assert(globalNonWritableDescriptor.enumerable, true); |
| eval('{ function boo() {} }'); |
| assert(this.hasOwnProperty("boo"), false); |
| assertThrow(() => boo, 'ReferenceError: Can\'t find variable: boo'); |