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

Unified Diff: pkg/intl/test/intl_message_basic_example_test.dart

Issue 16958006: Added async_helper and fixed broken asynchronous test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « no previous file | tests/async_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/intl/test/intl_message_basic_example_test.dart
diff --git a/pkg/intl/test/intl_message_basic_example_test.dart b/pkg/intl/test/intl_message_basic_example_test.dart
index d89ccd895f8ec9142d5379a84fd9a45efc0f2560..e9281eee2d6f222ac404a54976bfe8ec45af10d0 100644
--- a/pkg/intl/test/intl_message_basic_example_test.dart
+++ b/pkg/intl/test/intl_message_basic_example_test.dart
@@ -12,30 +12,28 @@ import '../example/basic/basic_example.dart';
import 'package:unittest/unittest.dart';
import 'dart:async';
-List list;
-
main() {
- list = [];
- setup(runAllTests, addToList);
-}
+ var list = [];
+ var waitForIt = new Completer();
-var waitForIt = new Completer();
-
-addToList(x) {
- list.add(x);
- if (list.length == 4) waitForIt.complete(list);
-}
+ addToList(x) {
+ list.add(x);
+ if (list.length == 4) {
+ waitForIt.complete(list);
+ }
+ }
-runAllTests(_) {
- setup(runProgram, addToList);
- waitForIt.future.then(actuallyRunTheTests);
-}
-
-actuallyRunTheTests(_) {
test('Verify basic example printing localized messages', () {
- expect(list[0], "Ran at 00:00:00 on Thursday, January 1, 1970");
- expect(list[1], "Ausgedruckt am 00:00:00 am Donnerstag, 1. Januar 1970.");
- expect(list[2], "วิ่ง 0:00:00 on วันพฤหัสบดี 1 มกราคม 1970.");
- expect(list[3], "วิ่ง now on today.");
+ runAllTests(_) {
+ setup(expectAsync1(runProgram), addToList);
+ }
+ setup(expectAsync1(runAllTests), addToList);
+ waitForIt.future.then(expectAsync1((_) {
+ expect(list[0], "Ran at 00:00:00 on Thursday, January 1, 1970");
+ expect(list[1], "Ausgedruckt am 00:00:00 am Donnerstag, 1. Januar 1970.");
+ expect(list[2], "วิ่ง 0:00:00 on วันพฤหัสบดี 1 มกราคม 1970.");
+ expect(list[3], "วิ่ง now on today.");
+ }));
});
}
+
« no previous file with comments | « no previous file | tests/async_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698