Fixed failing unit test on dumper where dates were not being stringified in a uniform timezone offest.

This commit is contained in:
Michael Mathews 2011-04-09 21:36:59 +02:00
parent 37b9e2bf78
commit d7675bbb2f
2 changed files with 4 additions and 4 deletions

View File

@ -75,7 +75,7 @@
output += '<RegExp ' + object + '>,\n' output += '<RegExp ' + object + '>,\n'
} }
else if ( isDate(object) ) { else if ( isDate(object) ) {
output += '<Date ' + object + '>,\n' output += '<Date ' + object.toUTCString() + '>,\n'
} }
else if ( isFunction(object) ) { else if ( isFunction(object) ) {
output += '<Function' + (object.name? ' '+ object.name : '') + '>,\n'; output += '<Function' + (object.name? ' '+ object.name : '') + '>,\n';

View File

@ -37,7 +37,7 @@ test('The module:module:common/dumper.dump function dumps regex values.', functi
}); });
test('The module:module:common/dumper.dump function dumps date values.', function() { test('The module:module:common/dumper.dump function dumps date values.', function() {
assert.equal(common.dumper.dump(new Date(1901, 0, 1)), '<Date Tue Jan 01 1901 00:00:00 GMT-0000 (GMT)>'); assert.equal(common.dumper.dump(new Date('January 1, 1901 GMT')), '<Date Tue, 01 Jan 1901 00:00:00 GMT>');
}); });
test('The module:module:common/dumper.dump function dumps function values.', function() { test('The module:module:common/dumper.dump function dumps function values.', function() {
@ -73,9 +73,9 @@ test('The module:common/dumper.dump function dumps complex mixed values.', funct
function Foo(){} function Foo(){}
var actual = common.dumper.dump( var actual = common.dumper.dump(
[undefined, null, new Foo(), 1, true, 'hello\n"world', new Error('oops'), /foo/gi, new Date(2010, 11, 26), {f: function myFunc(){}, o: {a:1}}] [undefined, null, new Foo(), 1, true, 'hello\n"world', new Error('oops'), /foo/gi, new Date('December 26, 2010 GMT'), {f: function myFunc(){}, o: {a:1}}]
), ),
expected = '[\n undefined,\n null,\n {\n },\n 1,\n true,\n "hello\\n\\"world",\n {\n "message": "oops"\n },\n <RegExp /foo/gi>,\n <Date Sun Dec 26 2010 00:00:00 GMT-0000 (GMT)>,\n {\n "f": <Function myFunc>,\n "o": {\n "a": 1\n }\n }\n]'; expected = '[\n undefined,\n null,\n {\n },\n 1,\n true,\n "hello\\n\\"world",\n {\n "message": "oops"\n },\n <RegExp /foo/gi>,\n <Date Sun, 26 Dec 2010 00:00:00 GMT>,\n {\n "f": <Function myFunc>,\n "o": {\n "a": 1\n }\n }\n]';
assert.equal(actual, expected); assert.equal(actual, expected);
}); });