OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import "package:expect/expect.dart"; |
| 6 import "dart:async"; |
| 7 import "dart:math"; |
| 8 |
| 9 part '../../../sdk/lib/io/common.dart'; |
| 10 part "../../../sdk/lib/io/io_sink.dart"; |
| 11 part "../../../sdk/lib/io/http.dart"; |
| 12 part "../../../sdk/lib/io/http_impl.dart"; |
| 13 part "../../../sdk/lib/io/http_parser.dart"; |
| 14 part "../../../sdk/lib/io/http_utils.dart"; |
| 15 part "../../../sdk/lib/io/socket.dart"; |
| 16 |
| 17 void testParseHttpCookieDate() { |
| 18 Expect.throws(() => _HttpUtils.parseCookieDate("")); |
| 19 |
| 20 test(int year, |
| 21 int month, |
| 22 int day, |
| 23 int hours, |
| 24 int minutes, |
| 25 int seconds, |
| 26 String formatted) { |
| 27 DateTime date = new DateTime.utc(year, month, day, hours, minutes, seconds,
0); |
| 28 Expect.equals(date, _HttpUtils.parseCookieDate(formatted)); |
| 29 } |
| 30 |
| 31 test(2012, DateTime.JUNE, 19, 14, 15, 01, "tue, 19-jun-12 14:15:01 gmt"); |
| 32 test(2021, DateTime.JUNE, 09, 10, 18, 14, "Wed, 09-Jun-2021 10:18:14 GMT"); |
| 33 test(2021, DateTime.JANUARY, 13, 22, 23, 01, "Wed, 13-Jan-2021 22:23:01 GMT"); |
| 34 test(2013, DateTime.JANUARY, 15, 21, 47, 38, "Tue, 15-Jan-2013 21:47:38 GMT"); |
| 35 test(1970, DateTime.JANUARY, 01, 00, 00, 01, "Thu, 01-Jan-1970 00:00:01 GMT"); |
| 36 } |
| 37 |
| 38 void main() { |
| 39 testParseHttpCookieDate(); |
| 40 } |
OLD | NEW |