OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library dart.io; | 5 library dart.io; |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 import "dart:async"; | 8 import "dart:async"; |
9 import "dart:collection"; | 9 import "dart:collection"; |
10 import "dart:convert"; | 10 import "dart:convert"; |
(...skipping 25 matching lines...) Expand all Loading... |
36 part "../../../sdk/lib/io/platform_impl.dart"; | 36 part "../../../sdk/lib/io/platform_impl.dart"; |
37 part "../../../sdk/lib/io/service_object.dart"; | 37 part "../../../sdk/lib/io/service_object.dart"; |
38 part "../../../sdk/lib/io/secure_socket.dart"; | 38 part "../../../sdk/lib/io/secure_socket.dart"; |
39 part "../../../sdk/lib/io/secure_server_socket.dart"; | 39 part "../../../sdk/lib/io/secure_server_socket.dart"; |
40 part "../../../sdk/lib/io/security_context.dart"; | 40 part "../../../sdk/lib/io/security_context.dart"; |
41 part "../../../sdk/lib/io/socket.dart"; | 41 part "../../../sdk/lib/io/socket.dart"; |
42 | 42 |
43 void testParseHttpCookieDate() { | 43 void testParseHttpCookieDate() { |
44 Expect.throws(() => HttpDate._parseCookieDate("")); | 44 Expect.throws(() => HttpDate._parseCookieDate("")); |
45 | 45 |
46 test(int year, | 46 test(int year, int month, int day, int hours, int minutes, int seconds, |
47 int month, | 47 String formatted) { |
48 int day, | |
49 int hours, | |
50 int minutes, | |
51 int seconds, | |
52 String formatted) { | |
53 DateTime date = | 48 DateTime date = |
54 new DateTime.utc(year, month, day, hours, minutes, seconds, 0); | 49 new DateTime.utc(year, month, day, hours, minutes, seconds, 0); |
55 Expect.equals(date, HttpDate._parseCookieDate(formatted)); | 50 Expect.equals(date, HttpDate._parseCookieDate(formatted)); |
56 } | 51 } |
57 | 52 |
58 test(2012, DateTime.JUNE, 19, 14, 15, 01, "tue, 19-jun-12 14:15:01 gmt"); | 53 test(2012, DateTime.JUNE, 19, 14, 15, 01, "tue, 19-jun-12 14:15:01 gmt"); |
59 test(2021, DateTime.JUNE, 09, 10, 18, 14, "Wed, 09-Jun-2021 10:18:14 GMT"); | 54 test(2021, DateTime.JUNE, 09, 10, 18, 14, "Wed, 09-Jun-2021 10:18:14 GMT"); |
60 test(2021, DateTime.JANUARY, 13, 22, 23, 01, "Wed, 13-Jan-2021 22:23:01 GMT"); | 55 test(2021, DateTime.JANUARY, 13, 22, 23, 01, "Wed, 13-Jan-2021 22:23:01 GMT"); |
61 test(2013, DateTime.JANUARY, 15, 21, 47, 38, "Tue, 15-Jan-2013 21:47:38 GMT"); | 56 test(2013, DateTime.JANUARY, 15, 21, 47, 38, "Tue, 15-Jan-2013 21:47:38 GMT"); |
62 test(1970, DateTime.JANUARY, 01, 00, 00, 01, "Thu, 01-Jan-1970 00:00:01 GMT"); | 57 test(1970, DateTime.JANUARY, 01, 00, 00, 01, "Thu, 01-Jan-1970 00:00:01 GMT"); |
63 } | 58 } |
64 | 59 |
65 void main() { | 60 void main() { |
66 testParseHttpCookieDate(); | 61 testParseHttpCookieDate(); |
67 } | 62 } |
OLD | NEW |