mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-24 13:01:24 +01:00
merge completed... now to fix all the bugs...
This commit is contained in:
commit
87c4d80fbc
3472 changed files with 466748 additions and 6517 deletions
34
node_modules/object-inspect/test/has.js
generated
vendored
Normal file
34
node_modules/object-inspect/test/has.js
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
function withoutProperty(object, property, fn) {
|
||||
var original;
|
||||
if (Object.getOwnPropertyDescriptor) {
|
||||
original = Object.getOwnPropertyDescriptor(object, property);
|
||||
} else {
|
||||
original = object[property];
|
||||
}
|
||||
delete object[property];
|
||||
try {
|
||||
fn();
|
||||
} finally {
|
||||
if (Object.getOwnPropertyDescriptor) {
|
||||
Object.defineProperty(object, property, original);
|
||||
} else {
|
||||
object[property] = original;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test('when Object#hasOwnProperty is deleted', function (t) {
|
||||
t.plan(1);
|
||||
var arr = [1, , 3]; // eslint-disable-line no-sparse-arrays
|
||||
|
||||
// eslint-disable-next-line no-extend-native
|
||||
Array.prototype[1] = 2; // this is needed to account for "in" vs "hasOwnProperty"
|
||||
|
||||
withoutProperty(Object.prototype, 'hasOwnProperty', function () {
|
||||
t.equal(inspect(arr), '[ 1, , 3 ]');
|
||||
});
|
||||
delete Array.prototype[1];
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue