Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
Use pumpEventQueue() from test (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 authored Nov 14, 2017
1 parent 8c6e4e0 commit ee7c7df
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 29 deletions.
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ dependencies:
stack_trace: '>=0.9.1 <2.0.0'
stream_channel: '^1.1.0'
dev_dependencies:
test: "^0.12.21"
test: "^0.12.28"
environment:
sdk: ">=1.8.0 <2.0.0"
2 changes: 0 additions & 2 deletions test/client/stream_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import 'package:test/test.dart';

import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;

import 'utils.dart';

void main() {
var responseController;
var requestController;
Expand Down
12 changes: 0 additions & 12 deletions test/client/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,3 @@ class ClientController {
_responseController.add(request);
}
}

/// Returns a [Future] that completes after pumping the event queue [times]
/// times. By default, this should pump the event queue enough times to allow
/// any code to run, as long as it's not waiting on some external event.
Future pumpEventQueue([int times = 20]) {
if (times == 0) return new Future.value();
// We use a delayed future to allow microtask events to finish. The
// Future.value or Future() constructors use scheduleMicrotask themselves and
// would therefore not wait for microtask callbacks that are scheduled after
// invoking this method.
return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1));
}
2 changes: 0 additions & 2 deletions test/server/stream_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import 'package:test/test.dart';

import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;

import 'utils.dart';

void main() {
var requestController;
var responseController;
Expand Down
12 changes: 0 additions & 12 deletions test/server/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,3 @@ Matcher throwsInvalidParams(String message) {
return true;
}));
}

/// Returns a [Future] that completes after pumping the event queue [times]
/// times. By default, this should pump the event queue enough times to allow
/// any code to run, as long as it's not waiting on some external event.
Future pumpEventQueue([int times = 20]) {
if (times == 0) return new Future.value();
// We use a delayed future to allow microtask events to finish. The
// Future.value or Future() constructors use scheduleMicrotask themselves and
// would therefore not wait for microtask callbacks that are scheduled after
// invoking this method.
return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1));
}

0 comments on commit ee7c7df

Please sign in to comment.