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

Unified Diff: packages/intl/test/date_time_format_test_stub.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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
Index: packages/intl/test/date_time_format_test_stub.dart
diff --git a/packages/intl/test/date_time_format_test_stub.dart b/packages/intl/test/date_time_format_test_stub.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e8141f65edf7c1d77cb93655139a9b0eec8933b1
--- /dev/null
+++ b/packages/intl/test/date_time_format_test_stub.dart
@@ -0,0 +1,68 @@
+// 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.
+
+/**
+ * Test date formatting and parsing using locale data which is available
+ * directly in the program as a constant.
+ */
+
+library date_time_format_test;
+
+import 'dart:async';
+import 'package:unittest/unittest.dart';
+import 'package:intl/intl.dart';
+import 'date_time_format_test_core.dart';
+
+typedef List<String> TestListFunc();
+
+typedef Future InitializeDateFormattingFunc(String locale, String filePath);
+
+/**
+ * Return only the odd-numbered locales. A simple way to divide the list into
+ * two roughly equal parts.
+ */
+List<String> oddLocales() {
+ int i = 1;
+ return allLocales().where((x) => (i++).isOdd).toList();
+}
+
+/**
+ * Return a set of a few locales to run just the tests on a small sample.
+ */
+List smallSetOfLocales() {
+ return allLocales().sublist(0, 10);
+}
+
+/**
+ * Return only the even-numbered locales. A simple way to divide the list into
+ * two roughly equal parts.
+ */
+List<String> evenLocales() {
+ int i = 1;
+ return allLocales().where((x) => !((i++).isOdd)).toList();
+}
+
+void runWith(TestListFunc getSubset, String dir,
+ InitializeDateFormattingFunc initFunction) {
+ // Initialize one locale just so we know what the list is.
+ // Also, note that we take the list of locales as a function so that we don't
+ // evaluate it until after we know that all the locales are available.
+
+ bool initialized = false;
+
+ setUp(() {
+ if (initialized) {
+ return null;
+ }
+ return initFunction("en_US", dir).then((_) {
+ return Future.forEach(DateFormat.allLocalesWithSymbols(), (locale) {
+ return initFunction(locale, dir);
+ });
+ }).then((_) {
+ initialized = true;
+ });
+ });
+
+ runDateTests(getSubset);
+}
« no previous file with comments | « packages/intl/test/date_time_format_test_data.dart ('k') | packages/intl/test/date_time_format_uninitialized_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698