Changeset 516 for Dev/trunk/node_modules/should/should.js
- Timestamp:
- 03/14/14 12:36:58 (11 years ago)
- Location:
- Dev/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk
- Property svn:ignore
-
old new 1 1 build 2 quod-erat.git
-
- Property svn:ignore
-
Dev/trunk/node_modules/should/should.js
r484 r516 189 189 }; 190 190 191 should.inspect = function(obj, opts) { 192 if(util.isDate(obj) && typeof obj.inspect !== 'function') obj = obj.toISOString(); 193 return inspect(obj, opts); 194 }; 191 should.inspect = inspect; 192 193 function i(value) { 194 if(util.isDate(value) && typeof value.inspect !== 'function') return value.toISOString(); //show millis in dates 195 return should.inspect(value); 196 } 195 197 196 198 /** … … 216 218 if(null == obj) { 217 219 throw new AssertionError({ 218 message: msg || ('expected ' + should.inspect(obj) + ' to exist')220 message: msg || ('expected ' + i(obj) + ' to exist') 219 221 , stackStartFunction: should.exist 220 222 }); … … 234 236 if (null != obj) { 235 237 throw new AssertionError({ 236 message: msg || ('expected ' + should.inspect(obj) + ' to not exist')238 message: msg || ('expected ' + i(obj) + ' to not exist') 237 239 , stackStartFunction: should.not.exist 238 240 }); … … 402 404 403 405 get inspect() { 404 return should.inspect(this.obj);406 return i(this.obj); 405 407 }, 406 408 … … 532 534 this.assert( 533 535 eql(val, this.obj) 534 , function(){ return 'expected ' + this.inspect + ' to equal ' + should.inspect(val) + (description ? " | " + description : "") }535 , function(){ return 'expected ' + this.inspect + ' to not equal ' + should.inspect(val) + (description ? " | " + description : "") }536 , function(){ return 'expected ' + this.inspect + ' to equal ' + i(val) + (description ? " | " + description : "") } 537 , function(){ return 'expected ' + this.inspect + ' to not equal ' + i(val) + (description ? " | " + description : "") } 536 538 , val 537 539 , true … … 551 553 this.assert( 552 554 val === this.obj 553 , function(){ return 'expected ' + this.inspect + ' to equal ' + should.inspect(val) + (description ? " | " + description : "") }554 , function(){ return 'expected ' + this.inspect + ' to not equal ' + should.inspect(val) + (description ? " | " + description : "") }555 , function(){ return 'expected ' + this.inspect + ' to equal ' + i(val) + (description ? " | " + description : "") } 556 , function(){ return 'expected ' + this.inspect + ' to not equal ' + i(val) + (description ? " | " + description : "") } 555 557 , val 556 558 , void 0 … … 804 806 if (this.negate && undefined !== val) { 805 807 if (undefined === this.obj[name]) { 806 throw new Error(this.inspect + ' has no property ' + should.inspect(name) + (description ? " | " + description : ""));808 throw new Error(this.inspect + ' has no property ' + i(name) + (description ? " | " + description : "")); 807 809 } 808 810 } else { 809 811 this.assert( 810 812 undefined !== this.obj[name] 811 , function(){ return 'expected ' + this.inspect + ' to have a property ' + should.inspect(name) + (description ? " | " + description : "") }812 , function(){ return 'expected ' + this.inspect + ' to not have a property ' + should.inspect(name) + (description ? " | " + description : "") }813 , function(){ return 'expected ' + this.inspect + ' to have a property ' + i(name) + (description ? " | " + description : "") } 814 , function(){ return 'expected ' + this.inspect + ' to not have a property ' + i(name) + (description ? " | " + description : "") } 813 815 , void 0 814 816 , void 0 … … 819 821 this.assert( 820 822 val === this.obj[name] 821 , function(){ return 'expected ' + this.inspect + ' to have a property ' + should.inspect(name)822 + ' of ' + should.inspect(val) + ', but got ' + should.inspect(this.obj[name]) + (description ? " | " + description : "") }823 , function(){ return 'expected ' + this.inspect + ' to not have a property ' + should.inspect(name) + ' of ' + should.inspect(val) + (description ? " | " + description : "") }823 , function(){ return 'expected ' + this.inspect + ' to have a property ' + i(name) 824 + ' of ' + i(val) + ', but got ' + i(this.obj[name]) + (description ? " | " + description : "") } 825 , function(){ return 'expected ' + this.inspect + ' to not have a property ' + i(name) + ' of ' + i(val) + (description ? " | " + description : "") } 824 826 , void 0 825 827 , void 0 … … 855 857 if (len > 1) { 856 858 names = names.map(function(name){ 857 return should.inspect(name);859 return i(name); 858 860 }); 859 861 var last = names.pop(); 860 862 str = names.join(', ') + ', and ' + last; 861 863 } else { 862 str = should.inspect(names[0]);864 str = i(names[0]); 863 865 } 864 866 … … 885 887 this.assert( 886 888 hasOwnProperty.call(this.obj, name) 887 , function(){ return 'expected ' + this.inspect + ' to have own property ' + should.inspect(name) + (description ? " | " + description : "") }888 , function(){ return 'expected ' + this.inspect + ' to not have own property ' + should.inspect(name) + (description ? " | " + description : "") }889 , function(){ return 'expected ' + this.inspect + ' to have own property ' + i(name) + (description ? " | " + description : "") } 890 , function(){ return 'expected ' + this.inspect + ' to not have own property ' + i(name) + (description ? " | " + description : "") } 889 891 , void 0 890 892 , void 0 … … 903 905 startWith: function(str, description) { 904 906 this.assert(0 === this.obj.indexOf(str) 905 , function() { return 'expected ' + this.inspect + ' to start with ' + should.inspect(str) + (description ? " | " + description : "") }906 , function() { return 'expected ' + this.inspect + ' to not start with ' + should.inspect(str) + (description ? " | " + description : "") }907 , function() { return 'expected ' + this.inspect + ' to start with ' + i(str) + (description ? " | " + description : "") } 908 , function() { return 'expected ' + this.inspect + ' to not start with ' + i(str) + (description ? " | " + description : "") } 907 909 , void 0 908 910 , void 0 … … 920 922 endWith: function(str, description) { 921 923 this.assert(-1 !== this.obj.indexOf(str, this.obj.length - str.length) 922 , function() { return 'expected ' + this.inspect + ' to end with ' + should.inspect(str) + (description ? " | " + description : "") }923 , function() { return 'expected ' + this.inspect + ' to not end with ' + should.inspect(str) + (description ? " | " + description : "") }924 , function() { return 'expected ' + this.inspect + ' to end with ' + i(str) + (description ? " | " + description : "") } 925 , function() { return 'expected ' + this.inspect + ' to not end with ' + i(str) + (description ? " | " + description : "") } 924 926 , void 0 925 927 , void 0 … … 942 944 this.assert( 943 945 eql(cmp, obj) 944 , function(){ return 'expected ' + this.inspect + ' to include an object equal to ' + should.inspect(obj) + (description ? " | " + description : "") }945 , function(){ return 'expected ' + this.inspect + ' to not include an object equal to ' + should.inspect(obj) + (description ? " | " + description : "") }946 , function(){ return 'expected ' + this.inspect + ' to include an object equal to ' + i(obj) + (description ? " | " + description : "") } 947 , function(){ return 'expected ' + this.inspect + ' to not include an object equal to ' + i(obj) + (description ? " | " + description : "") } 946 948 , void 0 947 949 , void 0 … … 950 952 this.assert( 951 953 ~this.obj.indexOf(obj) 952 , function(){ return 'expected ' + this.inspect + ' to include ' + should.inspect(obj) + (description ? " | " + description : "") }953 , function(){ return 'expected ' + this.inspect + ' to not include ' + should.inspect(obj) + (description ? " | " + description : "") }954 , function(){ return 'expected ' + this.inspect + ' to include ' + i(obj) + (description ? " | " + description : "") } 955 , function(){ return 'expected ' + this.inspect + ' to not include ' + i(obj) + (description ? " | " + description : "") } 954 956 , void 0 955 957 , void 0 … … 970 972 this.assert( 971 973 this.obj.some(function(item) { return eql(obj, item); }) 972 , function(){ return 'expected ' + this.inspect + ' to include an object equal to ' + should.inspect(obj) + (description ? " | " + description : "") }973 , function(){ return 'expected ' + this.inspect + ' to not include an object equal to ' + should.inspect(obj) + (description ? " | " + description : "") }974 , function(){ return 'expected ' + this.inspect + ' to include an object equal to ' + i(obj) + (description ? " | " + description : "") } 975 , function(){ return 'expected ' + this.inspect + ' to not include an object equal to ' + i(obj) + (description ? " | " + description : "") } 974 976 , void 0 975 977 , void 0 … … 1010 1012 if (len > 1) { 1011 1013 keys = keys.map(function(key){ 1012 return should.inspect(key);1014 return i(key); 1013 1015 }); 1014 1016 var last = keys.pop(); 1015 1017 str = keys.join(', ') + ', and ' + last; 1016 1018 } else { 1017 str = should.inspect(keys[0]);1019 str = i(keys[0]); 1018 1020 } 1019 1021 … … 1059 1061 this.assert( 1060 1062 code == status 1061 , function(){ return 'expected response code of ' + code + ' ' + should.inspect(statusCodes[code])1062 + ', but got ' + status + ' ' + should.inspect(statusCodes[status]) }1063 , function(){ return 'expected to not respond with ' + code + ' ' + should.inspect(statusCodes[code]) });1063 , function(){ return 'expected response code of ' + code + ' ' + i(statusCodes[code]) 1064 + ', but got ' + status + ' ' + i(statusCodes[status]) } 1065 , function(){ return 'expected to not respond with ' + code + ' ' + i(statusCodes[code]) }); 1064 1066 1065 1067 return this;
Note: See TracChangeset
for help on using the changeset viewer.