Add coverage for WeakMap usage.

This commit is contained in:
John-David Dalton
2014-08-25 09:32:26 -07:00
parent 7f88a7c9bb
commit 87c21ba75e
4 changed files with 107 additions and 3 deletions

View File

@@ -38,6 +38,7 @@
noop = function() {},
params = root.arguments,
push = arrayProto.push,
Set = root.Set,
slice = arrayProto.slice,
system = root.system,
toString = objectProto.toString,
@@ -339,8 +340,9 @@
function createToString(funcName) {
return _.constant(nativeString.replace(reToString, funcName));
}
// load ES6 Set shim
// load ES6 Set and WeakMap shims
require('./asset/set');
require('./asset/weakmap');
// expose `baseEach` for better code coverage
if (isModularize && !isNpm) {
@@ -443,6 +445,12 @@
};
}()));
if (Set) {
setProperty(root, 'Set', _.noop);
}
if (WeakMap) {
setProperty(root, 'WeakMap', _.noop);
}
// fake `WinRTError`
setProperty(root, 'WinRTError', Error);
@@ -485,6 +493,16 @@
} else {
delete root.ArrayBuffer;
}
if (Set) {
setProperty(root, 'Set', Set);
} else {
delete root.Set;
}
if (WeakMap) {
setProperty(root, 'WeakMap', WeakMap);
} else {
delete root.WeakMap;
}
delete root.WinRTError;
delete root.window;
delete funcProto._method;