
	function Lazy(t, a) {
		var hooks = []
		, hooked = []

		for (var i = a.length; i--; ) !function(k) {
			hooked.push([k, t.hasOwnProperty(k) && t[k]])
			t[k] = function(){hooks.push([k, arguments]);return t}
		}(a[i])

		t.resume = function() {
			delete t.resume

			for (var v, i = hooked.length;i--;) {
				if (hooked[i][1]) t[hooked[i][0]] = hooked[i][1]
				else delete t[hooked[i][0]]
			}
			// i == -1 from previous loop
			for (;v=hooks[++i];) t = t[v[0]].apply(t, v[1])
			t = hooks = hooked = null
		}
		return t
	}


		wait: function() {
			Lazy(this, ["it", "wait", "run", "ok", "equal", "anyOf", "describe", "done"])
			return this.resume
		},






//
M.lazy = function(t, a) {
	var hooks = []
	, hooked = []

	for (var i = a.length; i--; ) !function(k) {
		hooked.push([k, t.hasOwnProperty(k) && t[k]])
		t[k] = function(){hooks.push([k, arguments]);return t}
	}(a[i])

	return function(i, v) {
		for (i = hooked.length;i--;) {
			if (hooked[i][1]) t[hooked[i][0]] = hooked[i][1]
			else delete t[hooked[i][0]]
		}
		// i == -1 from previous loop
		for (;v=hooks[++i];) t = t[v[0]].apply(t, v[1])
	}
}


wait: function() {
	var resumer = M.lazy(this, ["it", "wait", "run", "ok", "equal", "anyOf", "describe", "done"])
	return resumer
}

// waiter
M.async = function(fn, bubbleErrors, _scope) {
	var pending = 0
	function cb(err) {
		var scope = _scope || this
		, args = arguments
		setTimeout(function() {
			if (fn && (--pending < 1 || err && bubbleErrors)) {
				fn.apply(scope, args)
				fn = 0
			}
		}, 1)
	}
	cb.next = function() {
		pending++
		return cb
	}
	return cb
}




function async(fn) {
	var t = this
	t.pending = 0
	t.cb = function(err) {
		if (err) t.pending =
		else setTimeout(function() {
			if (--t.pending === 0 && fn) fn()
		}, 1)
	}
}
// next()
async.prototype.wait = function() {
	this.pending++
	return this.cb
}



})(new Function('return this')());


