Files
test-repo/tests/date/date.js
T
Christopher Chedeau cf45afba61 Add testing
- This brings in the flow test suite that contains a ton of JavaScript parsing edge cases
- This creates snapshot tests using the pretty printer for all of them
- If uncomment `RUN_AST_TESTS` line in `tests/run_specs.js`, it checks ast(pretty_print(x)) == ast(x). Right now, "178 failed, 197 passed, 375 of 377 total". So half of the tests are not passing, most of them are crashes and many of the rest are subtle issues.
2016-12-23 19:51:53 +00:00

29 lines
681 B
JavaScript

var d = new Date(0);
var x:string = d.getTime();
var y:number = d;
// valid constructors
new Date();
new Date(1234567890);
new Date('2015/06/18');
new Date(2015, 6);
new Date(2015, 6, 18);
new Date(2015, 6, 18, 11);
new Date(2015, 6, 18, 11, 55);
new Date(2015, 6, 18, 11, 55, 42);
new Date(2015, 6, 18, 11, 55, 42, 999);
// invalid constructors
new Date({});
new Date(2015, '6');
new Date(2015, 6, '18');
new Date(2015, 6, 18, '11');
new Date(2015, 6, 18, 11, '55');
new Date(2015, 6, 18, 11, 55, '42');
new Date(2015, 6, 18, 11, 55, 42, '999');
// invalid constructors that we incorrectly consider valid
new Date('2015', 6);
new Date(2015, 6, 18, 11, 55, 42, 999, 'hahaha');