Skip to content

Commit

Permalink
Tests for "Invalid Date" in more cases
Browse files Browse the repository at this point in the history
Following the proposed specification in
tc39/ecma262#848
  • Loading branch information
littledan committed Mar 21, 2017
1 parent 975e54d commit bd685e5
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/built-ins/Date/prototype/toDateString/invalid-date.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-date.prototype.todatestring
description: Invalid Dates are rendered as "Invalid Date"
info: >
Date.prototype.toDateString ( )
...
3. If tv is NaN, return "Invalid Date".
...
---*/

assert.sameValue(new Date(NaN).toDateString(), "Invalid Date");


17 changes: 17 additions & 0 deletions test/built-ins/Date/prototype/toTimeString/invalid-date.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-date.prototype.totimestring
description: Invalid Dates are rendered as "Invalid Date"
info: >
Date.prototype.toTimeString ( )
...
3. If tv is NaN, return "Invalid Date".
...
---*/

assert.sameValue(new Date(NaN).toTimeString(), "Invalid Date");


16 changes: 16 additions & 0 deletions test/built-ins/Date/prototype/toUTCString/invalid-date.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-date.prototype.toutcstring
description: Invalid Dates are rendered as "Invalid Date"
info: >
Date.prototype.toUTCString ( )
...
3. If tv is NaN, return "Invalid Date".
...
---*/

assert.sameValue(new Date(NaN).toUTCString(), "Invalid Date");

0 comments on commit bd685e5

Please sign in to comment.