OLD | NEW |
(Empty) | |
| 1 dart_library.library('corelib/date_time_parse_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__date_time_parse_test(exports, dart_sdk, expect) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const dart = dart_sdk.dart; |
| 8 const dartx = dart_sdk.dartx; |
| 9 const expect$ = expect.expect; |
| 10 const date_time_parse_test = Object.create(null); |
| 11 let DateTimeAndStringTodynamic = () => (DateTimeAndStringTodynamic = dart.cons
tFn(dart.definiteFunctionType(dart.dynamic, [core.DateTime, core.String])))(); |
| 12 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 13 date_time_parse_test.check = function(expected, str) { |
| 14 let actual = core.DateTime.parse(str); |
| 15 expect$.Expect.equals(expected, actual); |
| 16 expect$.Expect.equals(expected.isUtc, actual.isUtc); |
| 17 }; |
| 18 dart.fn(date_time_parse_test.check, DateTimeAndStringTodynamic()); |
| 19 dart.copyProperties(date_time_parse_test, { |
| 20 get supportsMicroseconds() { |
| 21 return new core.DateTime.fromMicrosecondsSinceEpoch(1).microsecondsSinceEp
och == 1; |
| 22 } |
| 23 }); |
| 24 date_time_parse_test.main = function() { |
| 25 date_time_parse_test.check(new core.DateTime(2012, 2, 27, 13, 27), "2012-02-
27 13:27:00"); |
| 26 if (dart.test(date_time_parse_test.supportsMicroseconds)) { |
| 27 date_time_parse_test.check(new core.DateTime.utc(2012, 2, 27, 13, 27, 0, 1
23, 456), "2012-02-27 13:27:00.123456z"); |
| 28 } else { |
| 29 date_time_parse_test.check(new core.DateTime.utc(2012, 2, 27, 13, 27, 0, 1
23, 456), "2012-02-27 13:27:00.123z"); |
| 30 } |
| 31 date_time_parse_test.check(new core.DateTime(2012, 2, 27, 13, 27), "20120227
13:27:00"); |
| 32 date_time_parse_test.check(new core.DateTime(2012, 2, 27, 13, 27), "20120227
T132700"); |
| 33 date_time_parse_test.check(new core.DateTime(2012, 2, 27), "20120227"); |
| 34 date_time_parse_test.check(new core.DateTime(2012, 2, 27), "+20120227"); |
| 35 date_time_parse_test.check(new core.DateTime.utc(2012, 2, 27, 14), "2012-02-
27T14Z"); |
| 36 date_time_parse_test.check(new core.DateTime.utc(-12345, 1, 1), "-123450101
00:00:00 Z"); |
| 37 date_time_parse_test.check(new core.DateTime.utc(2012, 2, 27, 14), "2012-02-
27T14+00"); |
| 38 date_time_parse_test.check(new core.DateTime.utc(2012, 2, 27, 14), "2012-02-
27T14+0000"); |
| 39 date_time_parse_test.check(new core.DateTime.utc(2012, 2, 27, 14), "2012-02-
27T14+00:00"); |
| 40 date_time_parse_test.check(new core.DateTime.utc(2012, 2, 27, 14), "2012-02-
27T14 +00:00"); |
| 41 date_time_parse_test.check(new core.DateTime.utc(2015, 2, 14, 13, 0, 0, 0),
"2015-02-15T00:00+11"); |
| 42 date_time_parse_test.check(new core.DateTime.utc(2015, 2, 14, 13, 0, 0, 0),
"2015-02-15T00:00:00+11"); |
| 43 date_time_parse_test.check(new core.DateTime.utc(2015, 2, 14, 13, 0, 0, 0),
"2015-02-15T00:00:00+11:00"); |
| 44 if (dart.test(date_time_parse_test.supportsMicroseconds)) { |
| 45 date_time_parse_test.check(new core.DateTime.utc(2015, 2, 15, 0, 0, 0, 500
, 500), "2015-02-15T00:00:00.500500Z"); |
| 46 date_time_parse_test.check(new core.DateTime.utc(2015, 2, 15, 0, 0, 0, 511
, 500), "2015-02-15T00:00:00.511500Z"); |
| 47 } else { |
| 48 date_time_parse_test.check(new core.DateTime.utc(2015, 2, 15, 0, 0, 0, 501
), "2015-02-15T00:00:00.501Z"); |
| 49 date_time_parse_test.check(new core.DateTime.utc(2015, 2, 15, 0, 0, 0, 512
), "2015-02-15T00:00:00.512Z"); |
| 50 } |
| 51 }; |
| 52 dart.fn(date_time_parse_test.main, VoidTodynamic()); |
| 53 // Exports: |
| 54 exports.date_time_parse_test = date_time_parse_test; |
| 55 }); |
OLD | NEW |