Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(511)

Unified Diff: tests/standalone/io/http_cookie_date_test.dart

Issue 16812004: Make some HTTP utility functions public (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: One more status file update Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/lib/analyzer/analyze_tests.status ('k') | tests/standalone/io/http_date_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/http_cookie_date_test.dart
diff --git a/tests/standalone/io/http_cookie_date_test.dart b/tests/standalone/io/http_cookie_date_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..ea841f9993c867d580dfbc818e51f5691755b957
--- /dev/null
+++ b/tests/standalone/io/http_cookie_date_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+import "dart:async";
+import "dart:math";
+
+part '../../../sdk/lib/io/common.dart';
+part "../../../sdk/lib/io/io_sink.dart";
+part "../../../sdk/lib/io/http.dart";
+part "../../../sdk/lib/io/http_impl.dart";
+part "../../../sdk/lib/io/http_parser.dart";
+part "../../../sdk/lib/io/http_utils.dart";
+part "../../../sdk/lib/io/socket.dart";
+
+void testParseHttpCookieDate() {
+ Expect.throws(() => _HttpUtils.parseCookieDate(""));
+
+ test(int year,
+ int month,
+ int day,
+ int hours,
+ int minutes,
+ int seconds,
+ String formatted) {
+ DateTime date = new DateTime.utc(year, month, day, hours, minutes, seconds, 0);
+ Expect.equals(date, _HttpUtils.parseCookieDate(formatted));
+ }
+
+ test(2012, DateTime.JUNE, 19, 14, 15, 01, "tue, 19-jun-12 14:15:01 gmt");
+ test(2021, DateTime.JUNE, 09, 10, 18, 14, "Wed, 09-Jun-2021 10:18:14 GMT");
+ test(2021, DateTime.JANUARY, 13, 22, 23, 01, "Wed, 13-Jan-2021 22:23:01 GMT");
+ test(2013, DateTime.JANUARY, 15, 21, 47, 38, "Tue, 15-Jan-2013 21:47:38 GMT");
+ test(1970, DateTime.JANUARY, 01, 00, 00, 01, "Thu, 01-Jan-1970 00:00:01 GMT");
+}
+
+void main() {
+ testParseHttpCookieDate();
+}
« no previous file with comments | « tests/lib/analyzer/analyze_tests.status ('k') | tests/standalone/io/http_date_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698