WeakMap/WeakSet: Add test for non object keys

Add test for non object keys in the iterable passed to the constructor.

BUG=v8:3399
LOG=Y
R=rossberg@chromium.org

Review URL: https://codereview.chromium.org/451033003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23090 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
arv@chromium.org 2014-08-12 19:54:52 +00:00
parent 5ae2276f5a
commit 6c209206f5

View File

@ -1141,6 +1141,13 @@ TestSetConstructorNextNotAnObject(Set);
TestSetConstructorNextNotAnObject(WeakSet);
(function TestWeakSetConstructorNonObjectKeys() {
assertThrows(function() {
new WeakSet([1]);
}, TypeError);
})();
function TestMapConstructor(ctor) {
var m = new ctor(null);
assertSize(0, m);
@ -1286,3 +1293,10 @@ function TestMapConstructorIteratorNotObjectValues(ctor) {
}
TestMapConstructorIteratorNotObjectValues(Map);
TestMapConstructorIteratorNotObjectValues(WeakMap);
(function TestWeakMapConstructorNonObjectKeys() {
assertThrows(function() {
new WeakMap([[1, 2]])
}, TypeError);
})();