mirror of
https://github.com/tc39/test262.git
synced 2025-07-29 00:44:32 +02:00
built-ins/WeakMap/*: make all indentation consistent (depth & character) (#1428)
This commit is contained in:
parent
e0db75f74b
commit
621d34d5ea
@ -27,7 +27,10 @@ WeakMap.prototype.set = function(key, value) {
|
|||||||
});
|
});
|
||||||
return set.call(this, key, value);
|
return set.call(this, key, value);
|
||||||
};
|
};
|
||||||
var map = new WeakMap([[first, 42], [second, 43]]);
|
var map = new WeakMap([
|
||||||
|
[first, 42],
|
||||||
|
[second, 43]
|
||||||
|
]);
|
||||||
|
|
||||||
assert.sameValue(results.length, 2, 'Called WeakMap#set for each object');
|
assert.sameValue(results.length, 2, 'Called WeakMap#set for each object');
|
||||||
assert.sameValue(results[0].key, first, 'Adds object in order - first key');
|
assert.sameValue(results[0].key, first, 'Adds object in order - first key');
|
||||||
|
@ -20,14 +20,19 @@ var iterable = {};
|
|||||||
iterable[Symbol.iterator] = function() {
|
iterable[Symbol.iterator] = function() {
|
||||||
return {
|
return {
|
||||||
next: function() {
|
next: function() {
|
||||||
return { value: [], done: false };
|
return {
|
||||||
|
value: [],
|
||||||
|
done: false
|
||||||
|
};
|
||||||
},
|
},
|
||||||
return: function() {
|
return: function() {
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
WeakMap.prototype.set = function() { throw new Test262Error(); };
|
WeakMap.prototype.set = function() {
|
||||||
|
throw new Test262Error();
|
||||||
|
};
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
assert.throws(Test262Error, function() {
|
||||||
new WeakMap(iterable);
|
new WeakMap(iterable);
|
||||||
|
@ -28,7 +28,10 @@ var iterable = {};
|
|||||||
iterable[Symbol.iterator] = function() {
|
iterable[Symbol.iterator] = function() {
|
||||||
return {
|
return {
|
||||||
next: function() {
|
next: function() {
|
||||||
return { value: nextItem, done: false };
|
return {
|
||||||
|
value: nextItem,
|
||||||
|
done: false
|
||||||
|
};
|
||||||
},
|
},
|
||||||
return: function() {
|
return: function() {
|
||||||
count += 1;
|
count += 1;
|
||||||
|
@ -45,5 +45,7 @@ assert.throws(TypeError, function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
new WeakMap([['a', 1], 2]);
|
new WeakMap([
|
||||||
|
['a', 1], 2
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
@ -12,8 +12,8 @@ includes: [propertyHelper.js]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue(
|
assert.sameValue(
|
||||||
WeakMap.name, 'WeakMap',
|
WeakMap.name, 'WeakMap',
|
||||||
'The value of `WeakMap.name` is "WeakMap"'
|
'The value of `WeakMap.name` is "WeakMap"'
|
||||||
);
|
);
|
||||||
|
|
||||||
verifyNotEnumerable(WeakMap, 'name');
|
verifyNotEnumerable(WeakMap, 'name');
|
||||||
|
@ -22,7 +22,9 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
var foo = {};
|
var foo = {};
|
||||||
var map = new WeakMap([[foo, 42]]);
|
var map = new WeakMap([
|
||||||
|
[foo, 42]
|
||||||
|
]);
|
||||||
|
|
||||||
var result = map.delete(foo);
|
var result = map.delete(foo);
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ var key = {};
|
|||||||
|
|
||||||
assert.sameValue(
|
assert.sameValue(
|
||||||
map.get(key), undefined,
|
map.get(key), undefined,
|
||||||
'returns undefined if key is not on the weakmap'
|
'returns undefined if key is not on the weakmap'
|
||||||
);
|
);
|
||||||
|
|
||||||
map.set(key, 1);
|
map.set(key, 1);
|
||||||
|
@ -21,7 +21,9 @@ info: |
|
|||||||
var foo = {};
|
var foo = {};
|
||||||
var bar = {};
|
var bar = {};
|
||||||
var baz = [];
|
var baz = [];
|
||||||
var map = new WeakMap([[foo,0]]);
|
var map = new WeakMap([
|
||||||
|
[foo, 0]
|
||||||
|
]);
|
||||||
|
|
||||||
assert.sameValue(map.get(foo), 0);
|
assert.sameValue(map.get(foo), 0);
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
var foo = {};
|
var foo = {};
|
||||||
var map = new WeakMap([[foo, 1]]);
|
var map = new WeakMap([
|
||||||
|
[foo, 1]
|
||||||
|
]);
|
||||||
|
|
||||||
assert.sameValue(map.set(foo, 1), map, '`map.set(foo, 1)` returns `map`');
|
assert.sameValue(map.set(foo, 1), map, '`map.set(foo, 1)` returns `map`');
|
||||||
|
@ -20,14 +20,19 @@ var iterable = {};
|
|||||||
iterable[Symbol.iterator] = function() {
|
iterable[Symbol.iterator] = function() {
|
||||||
return {
|
return {
|
||||||
next: function() {
|
next: function() {
|
||||||
return { value: null, done: false };
|
return {
|
||||||
|
value: null,
|
||||||
|
done: false
|
||||||
|
};
|
||||||
},
|
},
|
||||||
return: function() {
|
return: function() {
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
WeakSet.prototype.add = function() { throw new Test262Error(); };
|
WeakSet.prototype.add = function() {
|
||||||
|
throw new Test262Error();
|
||||||
|
};
|
||||||
|
|
||||||
assert.throws(Test262Error, function() {
|
assert.throws(Test262Error, function() {
|
||||||
new WeakSet(iterable);
|
new WeakSet(iterable);
|
||||||
|
@ -12,8 +12,8 @@ includes: [propertyHelper.js]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue(
|
assert.sameValue(
|
||||||
WeakSet.name, 'WeakSet',
|
WeakSet.name, 'WeakSet',
|
||||||
'The value of `WeakSet.name` is "WeakSet"'
|
'The value of `WeakSet.name` is "WeakSet"'
|
||||||
);
|
);
|
||||||
|
|
||||||
verifyNotEnumerable(WeakSet, 'name');
|
verifyNotEnumerable(WeakSet, 'name');
|
||||||
|
@ -13,9 +13,9 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
WeakSet();
|
WeakSet();
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
WeakSet([]);
|
WeakSet([]);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user