|
221 | 221 | });
|
222 | 222 |
|
223 | 223 | testSuite.addTest("`stringify`", function () {
|
224 |
| - var expected = 20, value; |
| 224 | + var expected = 20, value, pattern; |
225 | 225 |
|
226 | 226 | this.serializes("null", null, "`null` is represented literally");
|
227 | 227 | this.serializes("null", 1 / 0, "`Infinity` is serialized as `null`");
|
|
251 | 251 | value[5] = 1;
|
252 | 252 | this.serializes("[null,null,null,null,null,1]", value, "Sparse arrays should serialize correctly");
|
253 | 253 |
|
254 |
| - value = new Date(1994, 6, 3); |
255 |
| - this.serializes('"1994-07-03T06:00:00.000Z"', value, "Dates are serialized using the simplified date time string format"); |
256 |
| - |
257 |
| - value = new Date(1993, 5, 2, 2, 10, 28, 224); |
258 |
| - this.serializes('"1993-06-02T08:10:28.224Z"', value, "The date time string should conform to the format outlined in the spec"); |
| 254 | + pattern = /^"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z"$/; |
| 255 | + this.ok(pattern.test(JSON.stringify(new Date(1994, 6, 3))), "Dates are serialized using the simplified date time string format"); |
| 256 | + this.ok(pattern.test(JSON.stringify(new Date(1993, 5, 2, 2, 10, 28, 224))), "The date time string should conform to the format outlined in the spec"); |
259 | 257 |
|
260 | 258 | // Safari 2 restricts date time values to the range `[(-2 ** 31),
|
261 | 259 | // (2 ** 31) - 1]`, which respectively correspond to the minimum and
|
|
0 commit comments