Permalink
Browse files

Test result(object, fn) syntax.

  • Loading branch information...
1 parent 84444e8 commit 8c7b3455e7dc69ec39c6f06f662bea523ae0f1be @ryanve committed Oct 29, 2013
Showing with 8 additions and 3 deletions.
  1. +8 −3 test/index.js
View
@@ -1,5 +1,8 @@
!function(aok) {
var plain = {}, instance = aok();
+ function called() {
+ return !arguments.length && this;
+ }
aok(function() {
return isFinite(this.id);
});
@@ -35,14 +38,16 @@
});
aok({
id: 'resultParams',
- test: aok.result(function() {
- return !arguments.length && aok === this;
- })
+ test: aok.result(called) === aok
});
aok({
id: 'resultReturn',
test: 1 === aok.result(1) && 1 === aok.result([1], 0)
});
+ aok({
+ id: 'resultDirect',
+ test: aok.result(instance, called) === instance
+ });
aok({
id: 'resultProto',
test: 1 === aok.prototype.result.call([1], 0)

0 comments on commit 8c7b345

Please sign in to comment.