feat(test_lib): implement SpyObject
This commit is contained in:
@@ -13,6 +13,9 @@ function argPositionName(i) {
|
||||
|
||||
var primitives = $traceurRuntime.type;
|
||||
|
||||
export function proxy(){
|
||||
}
|
||||
|
||||
function assertArgumentTypes(...params) {
|
||||
var actual, type;
|
||||
var currentArgErrors;
|
||||
@@ -78,11 +81,14 @@ function prettyPrint(value) {
|
||||
}
|
||||
|
||||
function isType(value, T, errors) {
|
||||
|
||||
if (T === primitives.void) {
|
||||
return typeof value === 'undefined';
|
||||
}
|
||||
|
||||
if (_isProxy(value)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (T === primitives.any || value === null) {
|
||||
return true;
|
||||
}
|
||||
@@ -143,6 +149,11 @@ function isType(value, T, errors) {
|
||||
// return res;
|
||||
}
|
||||
|
||||
function _isProxy(obj) {
|
||||
if (!obj || !obj.constructor || !obj.constructor.annotations) return false;
|
||||
return obj.constructor.annotations.filter((a) => a instanceof proxy).length > 0;
|
||||
}
|
||||
|
||||
function formatErrors(errors, indent = ' ') {
|
||||
return errors.map((e) => {
|
||||
if (typeof e === 'string') return indent + '- ' + e;
|
||||
|
||||
Reference in New Issue
Block a user