Permalink
Browse files

Ignore trailing undefined arguments to Spy() functions

  • Loading branch information...
1 parent 3b0f912 commit 575453b085767584426ef94ec1539282bef629b4 @ianb committed Oct 21, 2011
Showing with 6 additions and 1 deletion.
  1. +6 −1 doctest.js
View
@@ -1412,7 +1412,12 @@ doctest.Spy = function (name, options, extraOptions) {
return s + ':never called';
}
s += '(';
- for (var i=0; i<self.args.length; i++) {
+ // This eliminates trailing undefined arguments:
+ var length = self.args.length;
+ while (length && self.args[length-1] === undefined) {
+ length--;
+ }
+ for (var i=0; i<length; i++) {
if (i) {
s += ', ';
}

0 comments on commit 575453b

Please sign in to comment.