mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 15:01:29 +00:00
131da0516b
Add testing only stubs to dart:_http, and make it available for use in the standalone tests so that the tests can stop including platform library code directly using "part" directives (which can cause surprising breakage, since the same code gets included twice via different uris). TEST=Existing tests Change-Id: I1b5a5061008ef36980bd21b46a9d0fd701286f66 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262780 Reviewed-by: Kallen Tu <kallentu@google.com> Reviewed-by: Lasse Nielsen <lrn@google.com> Reviewed-by: Bob Nystrom <rnystrom@google.com>
32 lines
1.1 KiB
Dart
32 lines
1.1 KiB
Dart
// 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.
|
|
|
|
// ignore: IMPORT_INTERNAL_LIBRARY
|
|
import "dart:_http" show Testing$HttpDate;
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
var _parseCookieDate = Testing$HttpDate.test$_parseCookieDate;
|
|
|
|
void testParseHttpCookieDate() {
|
|
Expect.throws(() => _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, _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();
|
|
}
|