Skip to content

Commit

Permalink
Improve onUnhandledException test
Browse files Browse the repository at this point in the history
  • Loading branch information
mstniy committed Dec 25, 2023
1 parent 1fbd67d commit 551ea3f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/computed_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -655,27 +655,29 @@ void main() {
final s = ValueStream(sync: true);
s.add(0);

final c = $(() => myThrower(s.use));
final c = $(() => myThrower(s.useOr(42)));
final zone = Zone.current
.fork(specification: ZoneSpecification(handleUncaughtError: hUE));
final sub1 = zone.run(() => c.listen((event) {}, null));
await Future.value();
expect(ueCount, 1);
expect(lastError, 42);
await Future.value();
expect(ueCount, 2);
expect(lastError, 0);

s.add(1);
expect(ueCount, 2);
expect(ueCount, 3);
expect(lastError, 1);

final sub2 = zone.run(() => c.listen((event) {}, (err) {}));

s.add(2);
expect(ueCount, 2);
expect(ueCount, 3);

sub2.cancel();

s.add(3);
expect(ueCount, 3);
expect(ueCount, 4);
expect(lastError, 3);

sub1.cancel();
Expand Down

0 comments on commit 551ea3f

Please sign in to comment.