From 579fed7517e891ac144cfec6bb6dead79875500b Mon Sep 17 00:00:00 2001 From: "Sergey G. Grekhov" Date: Thu, 7 Dec 2023 11:01:15 +0200 Subject: [PATCH] #2119. Run dart formatter on LibTest/async tests (#2417) --- .../Completer/Completer.sync_A01_t01.dart | 4 +- .../Completer/Completer_class_A01_t01.dart | 4 +- .../Completer/completeError_A01_t01.dart | 16 ++--- .../DeferredLibrary_A01_t01.dart | 5 +- .../DeferredLibrary_A01_t01.lib.dart | 3 +- .../EventSink/EventSink_A01_t01.test.dart | 2 +- .../EventSink/addError_A01_t01.test.dart | 8 +-- LibTest/async/EventSink/add_A01_t01.test.dart | 8 +-- LibTest/async/EventSink/all_tests.lib.dart | 1 + .../async/EventSink/close_A01_t01.test.dart | 8 +-- .../equality_operator_A01_t01.test.dart | 2 +- .../EventSink/hashCode_A01_t01.test.dart | 2 +- .../noSuchMethodError_A01_t01.test.dart | 10 ++- .../EventSink/runtimeType_A01_t01.test.dart | 2 +- .../EventSink/toString_A01_t01.test.dart | 2 +- .../async/Future/Future.delayed_A01_t01.dart | 9 ++- .../async/Future/Future.delayed_A01_t03.dart | 11 +-- .../async/Future/Future.delayed_A02_t01.dart | 18 +++-- .../async/Future/Future.delayed_A03_t01.dart | 18 +++-- .../async/Future/Future.error_A01_t01.dart | 17 +++-- .../async/Future/Future.error_A01_t02.dart | 2 +- .../async/Future/Future.error_A01_t03.dart | 9 ++- .../Future/Future.microtask_A01_t02.dart | 14 ++-- .../Future/Future.microtask_A01_t03.dart | 30 ++++---- .../Future/Future.microtask_A01_t04.dart | 9 ++- LibTest/async/Future/Future.sync_A01_t03.dart | 26 +++---- LibTest/async/Future/Future.sync_A01_t04.dart | 30 ++++---- .../async/Future/Future.value_A01_t01.dart | 10 ++- LibTest/async/Future/Future_A01_t02.dart | 9 ++- LibTest/async/Future/Future_A01_t03.dart | 25 +++---- LibTest/async/Future/Future_A01_t04.dart | 9 ++- LibTest/async/Future/asStream_A01_t02.dart | 19 +++-- LibTest/async/Future/asStream_A02_t01.dart | 19 +++-- LibTest/async/Future/asStream_A02_t02.dart | 17 ++--- LibTest/async/Future/catchError_A01_t01.dart | 6 +- LibTest/async/Future/catchError_A03_t01.dart | 27 +++----- LibTest/async/Future/catchError_A03_t02.dart | 32 ++++----- LibTest/async/Future/catchError_A03_t03.dart | 35 ++++------ LibTest/async/Future/catchError_A03_t04.dart | 31 ++++----- LibTest/async/Future/catchError_A03_t05.dart | 34 ++++----- LibTest/async/Future/catchError_A03_t06.dart | 36 ++++------ LibTest/async/Future/catchError_A04_t01.dart | 19 ++--- LibTest/async/Future/catchError_A04_t02.dart | 22 +++--- LibTest/async/Future/catchError_A04_t03.dart | 24 +++---- LibTest/async/Future/catchError_A05_t01.dart | 30 +++----- LibTest/async/Future/catchError_A06_t01.dart | 23 +++---- LibTest/async/Future/catchError_A07_t01.dart | 2 +- LibTest/async/Future/doWhile_A01_t01.dart | 10 ++- LibTest/async/Future/doWhile_A01_t02.dart | 10 ++- LibTest/async/Future/doWhile_A01_t03.dart | 10 ++- LibTest/async/Future/doWhile_A02_t01.dart | 17 ++--- LibTest/async/Future/doWhile_A02_t02.dart | 17 ++--- LibTest/async/Future/doWhile_A02_t03.dart | 15 ++-- LibTest/async/Future/doWhile_A05_t01.dart | 10 ++- LibTest/async/Future/forEach_A01_t02.dart | 2 +- LibTest/async/Future/forEach_A01_t03.dart | 10 ++- LibTest/async/Future/forEach_A02_t01.dart | 12 ++-- LibTest/async/Future/forEach_A03_t01.dart | 4 +- LibTest/async/Future/forEach_A03_t02.dart | 6 +- LibTest/async/Future/then_A01_t02.dart | 2 +- LibTest/async/Future/then_A02_t01.dart | 21 +++--- LibTest/async/Future/then_A02_t02.dart | 26 +++---- LibTest/async/Future/then_A02_t03.dart | 28 +++----- LibTest/async/Future/then_A03_t01.dart | 16 ++--- LibTest/async/Future/then_A04_t01.dart | 22 +++--- LibTest/async/Future/then_A05_t02.dart | 2 +- LibTest/async/Future/timeout_A01_t01.dart | 10 ++- LibTest/async/Future/timeout_A02_t01.dart | 16 ++--- LibTest/async/Future/timeout_A02_t02.dart | 15 ++-- LibTest/async/Future/timeout_A02_t03.dart | 20 +++--- LibTest/async/Future/timeout_A03_t01.dart | 17 ++--- LibTest/async/Future/wait_A01_t01.dart | 33 ++++----- LibTest/async/Future/wait_A01_t03.dart | 9 ++- LibTest/async/Future/wait_A01_t04.dart | 13 ++-- LibTest/async/Future/wait_A02_t01.dart | 25 +++---- LibTest/async/Future/wait_A02_t02.dart | 25 +++---- LibTest/async/Future/wait_A03_t01.dart | 37 +++++----- LibTest/async/Future/wait_A04_t01.dart | 23 +++---- LibTest/async/Future/wait_A04_t02.dart | 23 +++---- .../async/Future/whenComplete_A01_t01.dart | 1 - .../async/Future/whenComplete_A02_t01.dart | 1 - .../async/Future/whenComplete_A02_t02.dart | 12 ++-- .../async/Future/whenComplete_A03_t01.dart | 17 ++--- .../async/Future/whenComplete_A04_t01.dart | 1 - .../async/Future/whenComplete_A04_t02.dart | 20 +++--- .../async/Stream/Stream.empty_A02_t01.dart | 13 ++-- .../Stream.eventTransformed_A01_t01.dart | 1 + .../Stream.eventTransformed_A01_t02.dart | 5 +- .../Stream/Stream.fromFuture_A02_t02.dart | 11 ++- .../Stream/Stream.fromFutures_A01_t01.dart | 20 +++--- .../Stream/Stream.fromFutures_A01_t02.dart | 20 +++--- .../Stream/Stream.fromFutures_A02_t01.dart | 22 +++--- .../Stream/Stream.fromFutures_A02_t02.dart | 22 +++--- .../Stream/Stream.fromFutures_all_t01.dart | 6 +- .../Stream/Stream.fromIterable_A01_t01.dart | 2 - .../async/Stream/Stream.periodic_A02_t01.dart | 4 +- .../async/Stream/Stream.periodic_all_t02.dart | 27 ++++---- LibTest/async/Stream/Stream_A01_t01.dart | 24 +++---- LibTest/async/Stream/allTests_A01.lib.dart | 2 +- LibTest/async/Stream/allTests_A02.lib.dart | 1 + LibTest/async/Stream/allTests_A03.lib.dart | 1 + LibTest/async/Stream/any_A01_t01.test.dart | 13 ++-- LibTest/async/Stream/any_A01_t02.test.dart | 13 ++-- LibTest/async/Stream/any_A02_t01.test.dart | 8 +-- .../asBroadcastStream_A01_t01.test.dart | 1 + .../asBroadcastStream_A01_t02.test.dart | 1 + .../Stream/asBroadcastStream_A01_t03.dart | 20 +++--- .../asBroadcastStream_A01_t04.test.dart | 34 ++++----- .../Stream/asBroadcastStream_A01_t05.dart | 26 +++---- .../Stream/asBroadcastStream_A01_t06.dart | 16 ++--- .../Stream/asBroadcastStream_A01_t07.dart | 40 +++++------ .../asBroadcastStream_A03_t01.test.dart | 4 +- .../asBroadcastStream_A03_t02.test.dart | 7 +- .../asBroadcastStream_A03_t03.test.dart | 9 +-- .../asBroadcastStream_A04_t01.test.dart | 9 ++- .../asBroadcastStream_A04_t02.test.dart | 29 ++++---- .../asBroadcastStream_A04_t03.test.dart | 45 ++++++------ .../asBroadcastStream_A05_t01.test.dart | 3 +- .../asBroadcastStream_A05_t02.test.dart | 15 ++-- .../asBroadcastStream_A05_t03.test.dart | 3 +- .../Stream/asyncExpand_A01_t01.test.dart | 17 +++-- .../Stream/asyncExpand_A02_t01.test.dart | 26 +++---- .../Stream/asyncExpand_A03_t01.test.dart | 24 +++---- .../async/Stream/asyncMap_A01_t01.test.dart | 7 +- .../async/Stream/asyncMap_A01_t02.test.dart | 7 +- .../async/Stream/asyncMap_A01_t03.test.dart | 3 +- .../async/Stream/asyncMap_A01_t04.test.dart | 6 +- .../async/Stream/asyncMap_A02_t01.test.dart | 14 ++-- .../async/Stream/asyncMap_A03_t01.test.dart | 8 +-- .../async/Stream/asyncMap_A03_t02.test.dart | 5 +- .../async/Stream/asyncMap_A03_t03.test.dart | 16 ++--- .../async/Stream/asyncMap_A04_t01.test.dart | 34 ++++----- .../async/Stream/contains_A01_t01.test.dart | 1 + .../async/Stream/contains_A02_t01.test.dart | 3 +- .../async/Stream/contains_A03_t01.test.dart | 1 + .../async/Stream/contains_A03_t02.test.dart | 5 +- .../async/Stream/contains_A03_t03.test.dart | 5 +- .../async/Stream/distinct_A01_t01.test.dart | 18 +++-- .../async/Stream/distinct_A01_t02.test.dart | 43 +++++------- .../async/Stream/distinct_A02_t01.test.dart | 10 +-- .../async/Stream/distinct_A02_t02.test.dart | 22 +++--- .../async/Stream/distinct_A03_t01.test.dart | 42 +++++------ .../async/Stream/distinct_A04_t01.test.dart | 9 ++- .../async/Stream/distinct_A04_t02.test.dart | 9 ++- .../async/Stream/distinct_A05_t01.test.dart | 11 +-- LibTest/async/Stream/drain_A01_t01.test.dart | 4 +- LibTest/async/Stream/drain_A02_t01.test.dart | 7 +- LibTest/async/Stream/drain_A02_t02.test.dart | 5 +- .../async/Stream/elementAt_A01_t01.test.dart | 6 +- .../async/Stream/elementAt_A01_t02.test.dart | 13 ++-- .../async/Stream/elementAt_A01_t03.test.dart | 21 +++--- .../async/Stream/elementAt_A03_t01.test.dart | 1 + LibTest/async/Stream/every_A01_t01.test.dart | 22 ++++-- LibTest/async/Stream/every_A02_t01.test.dart | 12 ++-- LibTest/async/Stream/every_A03_t01.test.dart | 3 +- LibTest/async/Stream/expand_A01_t01.test.dart | 12 +++- LibTest/async/Stream/expand_A02_t01.test.dart | 16 ++--- LibTest/async/Stream/expand_A03_t01.test.dart | 40 +++++------ .../async/Stream/firstWhere_A01_t01.test.dart | 1 + .../async/Stream/firstWhere_A02_t01.test.dart | 1 + .../async/Stream/firstWhere_A03_t02.test.dart | 1 + .../async/Stream/firstWhere_A03_t03.test.dart | 3 +- .../async/Stream/firstWhere_A03_t04.test.dart | 3 +- .../async/Stream/firstWhere_A04_t01.test.dart | 15 ++-- LibTest/async/Stream/first_A01_t01.test.dart | 3 +- LibTest/async/Stream/first_A02_t01.test.dart | 1 + LibTest/async/Stream/first_A02_t02.test.dart | 13 ++-- LibTest/async/Stream/first_A04_t01.test.dart | 15 ++-- LibTest/async/Stream/fold_A01_t01.test.dart | 5 +- LibTest/async/Stream/fold_A01_t02.test.dart | 1 + .../async/Stream/forEach_A01_t01.test.dart | 11 ++- .../async/Stream/forEach_A02_t01.test.dart | 8 +-- .../async/Stream/forEach_A02_t02.test.dart | 18 ++--- .../Stream/handleError_A01_t01.test.dart | 4 +- .../Stream/handleError_A02_t01.test.dart | 11 +-- .../Stream/handleError_A03_t01.test.dart | 69 ++++++++++--------- LibTest/async/Stream/handleError_A04_t01.dart | 4 +- LibTest/async/Stream/handleError_A04_t02.dart | 2 +- .../Stream/handleError_A06_t01.test.dart | 11 +-- .../Stream/handleError_A07_t01.test.dart | 4 +- LibTest/async/Stream/isBroadcast_A01_t01.dart | 21 +++--- .../async/Stream/isEmpty_A01_t01.test.dart | 7 +- .../async/Stream/isEmpty_A02_t01.test.dart | 23 +++---- .../async/Stream/isEmpty_A03_t01.test.dart | 13 ++-- .../async/Stream/isEmpty_A04_t01.test.dart | 15 ++-- LibTest/async/Stream/join_A01_t01.test.dart | 1 + LibTest/async/Stream/join_A01_t02.test.dart | 1 + LibTest/async/Stream/join_A02_t01.test.dart | 5 +- LibTest/async/Stream/join_A02_t02.test.dart | 1 + .../async/Stream/lastWhere_A01_t01.test.dart | 10 +-- .../async/Stream/lastWhere_A01_t02.test.dart | 14 ++-- .../async/Stream/lastWhere_A02_t01.test.dart | 1 + .../async/Stream/lastWhere_A03_t01.test.dart | 10 +-- .../async/Stream/lastWhere_A05_t01.test.dart | 7 +- .../async/Stream/lastWhere_A06_t01.test.dart | 5 +- LibTest/async/Stream/last_A01_t01.test.dart | 3 +- LibTest/async/Stream/last_A02_t01.test.dart | 1 + LibTest/async/Stream/last_A03_t01.test.dart | 11 ++- LibTest/async/Stream/length_A01_t01.test.dart | 7 +- LibTest/async/Stream/length_A02_t01.test.dart | 6 +- LibTest/async/Stream/listen_A01_t01.test.dart | 16 ++--- LibTest/async/Stream/listen_A02_t01.test.dart | 9 ++- LibTest/async/Stream/listen_A03_t01.test.dart | 12 ++-- LibTest/async/Stream/listen_A04_t01.test.dart | 56 ++++++++------- LibTest/async/Stream/listen_A05_t02.dart | 2 +- LibTest/async/Stream/listen_A06_t01.test.dart | 13 +++- LibTest/async/Stream/map_A02_t01.test.dart | 4 +- LibTest/async/Stream/map_A03_t01.test.dart | 6 +- LibTest/async/Stream/map_A04_t01.test.dart | 14 ++-- LibTest/async/Stream/map_A05_t01.test.dart | 34 ++++----- LibTest/async/Stream/pipe_A01_t01.test.dart | 1 + LibTest/async/Stream/pipe_A01_t02.test.dart | 19 +++-- LibTest/async/Stream/pipe_A02_t01.test.dart | 34 ++++----- LibTest/async/Stream/pipe_A03_t01.test.dart | 30 ++++---- LibTest/async/Stream/pipe_A03_t02.test.dart | 51 ++++++-------- LibTest/async/Stream/pipe_A04_t01.test.dart | 20 +++--- LibTest/async/Stream/pipe_A04_t02.test.dart | 43 +++++------- LibTest/async/Stream/reduce_A01_t01.test.dart | 1 + LibTest/async/Stream/reduce_A01_t02.test.dart | 8 +-- LibTest/async/Stream/reduce_A01_t03.test.dart | 3 +- LibTest/async/Stream/reduce_A01_t04.test.dart | 13 ++-- LibTest/async/Stream/reduce_A02_t01.test.dart | 19 +++-- LibTest/async/Stream/reduce_A03_t01.test.dart | 6 +- .../Stream/singleWhere_A01_t01.test.dart | 8 +-- LibTest/async/Stream/single_A01_t01.test.dart | 1 + LibTest/async/Stream/single_A02_t01.test.dart | 1 + .../async/Stream/skipWhile_A01_t01.test.dart | 4 +- .../async/Stream/skipWhile_A02_t01.test.dart | 11 ++- .../async/Stream/skipWhile_A03_t01.test.dart | 5 +- .../async/Stream/skipWhile_A04_t01.test.dart | 20 +++--- LibTest/async/Stream/skip_A01_t01.test.dart | 15 +++- LibTest/async/Stream/skip_A02_t01.test.dart | 1 + LibTest/async/Stream/skip_A03_t01.test.dart | 12 +++- .../async/Stream/takeWhile_A01_t01.test.dart | 10 +-- .../async/Stream/takeWhile_A01_t02.test.dart | 19 +++-- .../async/Stream/takeWhile_A01_t03.test.dart | 23 +++---- .../async/Stream/takeWhile_A02_t01.test.dart | 1 + LibTest/async/Stream/take_A01_t01.test.dart | 22 ++++-- LibTest/async/Stream/take_A01_t02.test.dart | 24 ++++--- LibTest/async/Stream/take_A01_t03.dart | 18 ++--- LibTest/async/Stream/take_A02_t01.test.dart | 1 + .../async/Stream/timeout_A01_t01.test.dart | 9 ++- .../async/Stream/timeout_A01_t02.test.dart | 6 +- .../async/Stream/timeout_A02_t01.test.dart | 10 +-- .../async/Stream/timeout_A02_t02.test.dart | 45 +++++------- .../async/Stream/timeout_A03_t01.test.dart | 26 ++++--- .../async/Stream/timeout_A03_t02.test.dart | 50 ++++++-------- LibTest/async/Stream/timeout_A04_t01.dart | 7 +- .../async/Stream/timeout_A05_t01.test.dart | 16 +++-- LibTest/async/Stream/toList_A01_t01.test.dart | 23 +++++-- LibTest/async/Stream/toSet_A01_t01.test.dart | 21 ++++-- .../async/Stream/transform_A01_t01.test.dart | 4 +- .../async/Stream/transform_A01_t02.test.dart | 14 ++-- LibTest/async/Stream/where_A01_t01.test.dart | 13 ++-- LibTest/async/Stream/where_A01_t02.test.dart | 22 ++++-- .../StreamConsumer_A01_t01.test.dart | 2 +- .../addStream_A01_t01.test.dart | 8 +-- .../addStream_A02_t01.test.dart | 10 +-- .../async/StreamConsumer/all_tests.lib.dart | 1 + .../StreamConsumer/close_A01_t01.test.dart | 9 +-- .../equality_operator_A01_t01.test.dart | 2 +- .../StreamConsumer/hashCode_A01_t01.test.dart | 2 +- .../noSuchMethodError_A01_t01.test.dart | 10 ++- .../runtimeType_A01_t01.test.dart | 2 +- .../StreamConsumer/toString_A01_t01.test.dart | 2 +- .../StreamController.broadcast_A01_t01.dart | 8 ++- .../StreamController.broadcast_A01_t03.dart | 23 +++---- .../StreamController.broadcast_A03_t01.dart | 11 ++- .../StreamController.broadcast_A04_t01.dart | 8 ++- .../StreamController.broadcast_A05_t01.dart | 3 +- .../StreamController.broadcast_A06_t01.dart | 10 ++- .../StreamController.broadcast_A06_t02.dart | 30 ++++---- .../StreamController.broadcast_A06_t03.dart | 30 ++++---- .../StreamController.broadcast_A07_t01.dart | 10 ++- .../StreamController.broadcast_A07_t02.dart | 10 ++- .../StreamController.broadcast_A07_t03.dart | 32 ++++----- .../StreamController.broadcast_A08_t01.dart | 21 +++--- .../StreamController.broadcast_A08_t02.dart | 3 +- ...ntroller.broadcast_Stream_all_A01_t01.dart | 23 +++---- ...ntroller.broadcast_Stream_all_A01_t02.dart | 27 ++++---- ...ntroller.broadcast_Stream_all_A01_t03.dart | 23 +++---- ...ntroller.broadcast_Stream_all_A02_t01.dart | 35 +++++----- ...ntroller.broadcast_Stream_all_A02_t02.dart | 39 +++++------ ...ntroller.broadcast_Stream_all_A02_t03.dart | 35 +++++----- .../StreamController_A02_t01.dart | 7 +- .../StreamController_A03_t01.dart | 15 ++-- .../StreamController_A04_t01.dart | 6 +- .../StreamController_A05_t01.dart | 10 ++- .../StreamController_A06_t01.dart | 10 ++- .../StreamController_A06_t02.dart | 18 ++--- .../StreamController_A07_t01.dart | 20 ++---- .../StreamController/addError_A01_t01.dart | 15 ++-- .../StreamController/addError_A01_t02.dart | 17 ++--- .../StreamController/addStream_A02_t02.dart | 22 +++--- .../StreamController/addStream_A03_t01.dart | 27 ++++---- .../StreamController/addStream_A03_t02.dart | 27 ++++---- .../async/StreamController/add_A01_t01.dart | 10 ++- .../async/StreamController/close_A01_t02.dart | 18 ++--- .../async/StreamController/done_A01_t03.dart | 24 +++---- .../StreamController/hasListener_A01_t01.dart | 4 +- .../StreamController/hasListener_A01_t02.dart | 12 +++- .../StreamController/isClosed_A01_t01.dart | 7 +- .../StreamController/isClosed_A01_t02.dart | 8 +-- .../StreamController/isPaused_A01_t01.dart | 6 +- .../StreamController/isPaused_A01_t03.dart | 6 +- .../async/StreamController/sink_A01_t01.dart | 16 +++-- .../StreamController/stream_all_A01_t02.dart | 4 +- .../StreamController/stream_all_A02_t01.dart | 35 +++++----- .../StreamController/stream_all_A02_t02.dart | 38 +++++----- .../StreamController/stream_all_A02_t03.dart | 35 +++++----- .../async/StreamIterator/cancel_A01_t01.dart | 1 + .../async/StreamIterator/current_A01_t02.dart | 1 - .../StreamIterator/moveNext_A01_t01.dart | 1 + .../StreamSink_inherited_tests.lib.dart | 1 + .../async/StreamSink/addStream_A01_t01.dart | 4 +- LibTest/async/StreamSink/add_A01_t01.dart | 2 +- ...treamTransformer.fromHandlers_A01_t04.dart | 29 ++++---- .../StreamTransformer_A01_t02.dart | 11 ++- .../StreamTransformer_A01_t03.dart | 11 ++- .../StreamTransformer_A02_t01.dart | 13 ++-- .../StreamTransformer_A02_t02.dart | 20 +++--- .../StreamTransformer_A03_t01.dart | 43 +++++------- .../StreamTransformer_A03_t02.dart | 44 +++++------- LibTest/async/Timer/cancel_A01_t01.dart | 7 +- LibTest/async/Timer/cancel_A01_t02.dart | 7 +- .../bindBinaryCallbackGuarded_A01_t01.dart | 1 - .../bindBinaryCallbackGuarded_A01_t02.dart | 12 ++-- .../Zone/bindBinaryCallback_A01_t01.dart | 2 +- .../Zone/bindCallbackGuarded_A01_t02.dart | 7 +- LibTest/async/Zone/bindCallback_A01_t02.dart | 7 +- .../bindUnaryCallbackGuarded_A01_t01.dart | 2 +- .../bindUnaryCallbackGuarded_A01_t02.dart | 9 +-- .../async/Zone/bindUnaryCallback_A01_t01.dart | 2 +- .../async/Zone/bindUnaryCallback_A01_t02.dart | 13 ++-- LibTest/async/Zone/createTimer_A01_t01.dart | 1 - LibTest/async/Zone/current_A01_t02.dart | 2 +- LibTest/async/Zone/fork_A01_t01.dart | 2 +- .../Zone/handleUncaughtError_A01_t02.dart | 10 +-- .../Zone/handleUncaughtError_A01_t03.dart | 8 +-- .../Zone/handleUncaughtError_A01_t04.dart | 10 +-- .../async/Zone/inSameErrorZone_A01_t03.dart | 4 +- .../async/Zone/inSameErrorZone_A01_t04.dart | 4 +- .../async/Zone/inSameErrorZone_A01_t05.dart | 7 +- .../Zone/operator_subscript_A01_t01.dart | 6 +- .../Zone/registerBinaryCallback_A01_t01.dart | 22 +++--- .../async/Zone/registerCallback_A01_t01.dart | 18 +++-- .../Zone/registerUnaryCallback_A01_t01.dart | 20 +++--- .../async/Zone/runBinaryGuarded_A01_t02.dart | 7 +- LibTest/async/Zone/runBinary_A01_t01.dart | 12 ++-- LibTest/async/Zone/runBinary_A01_t02.dart | 13 ++-- LibTest/async/Zone/runGuarded_A01_t02.dart | 7 +- .../async/Zone/runUnaryGuarded_A01_t02.dart | 7 +- LibTest/async/Zone/runUnary_A01_t01.dart | 11 ++- LibTest/async/Zone/run_A01_t02.dart | 9 +-- 354 files changed, 2228 insertions(+), 2532 deletions(-) diff --git a/LibTest/async/Completer/Completer.sync_A01_t01.dart b/LibTest/async/Completer/Completer.sync_A01_t01.dart index 8e663bc17c..17bde88d1a 100644 --- a/LibTest/async/Completer/Completer.sync_A01_t01.dart +++ b/LibTest/async/Completer/Completer.sync_A01_t01.dart @@ -17,7 +17,9 @@ main() { Completer completer = new Completer.sync(); Future f = completer.future; var value; - f.then((v) {value = v;}); + f.then((v) { + value = v; + }); completer.complete(cv); Expect.identical(cv, value); } diff --git a/LibTest/async/Completer/Completer_class_A01_t01.dart b/LibTest/async/Completer/Completer_class_A01_t01.dart index f9fa29cc53..1417b0e9d8 100644 --- a/LibTest/async/Completer/Completer_class_A01_t01.dart +++ b/LibTest/async/Completer/Completer_class_A01_t01.dart @@ -13,10 +13,10 @@ import "dart:async"; Object create() => new Completer(); List createEqual(int number) => - new List.filled(number, new Completer(), growable:false); + new List.filled(number, new Completer(), growable: false); List createNonEqual(int number) => - new List.generate(number, (_) => new Completer(), growable:false); + new List.generate(number, (_) => new Completer(), growable: false); main() { object.test(create, createEqual, createNonEqual); diff --git a/LibTest/async/Completer/completeError_A01_t01.dart b/LibTest/async/Completer/completeError_A01_t01.dart index fdcc2f8ec1..bb3e7d243b 100644 --- a/LibTest/async/Completer/completeError_A01_t01.dart +++ b/LibTest/async/Completer/completeError_A01_t01.dart @@ -14,7 +14,7 @@ import "../../../Utils/expect.dart"; import "dart:async"; List> futures = []; -int count=0; +int count = 0; check(value) { var completer = new Completer(); @@ -23,14 +23,12 @@ check(value) { completer.completeError(value); asyncStart(); - futures.add(future.then( - (fValue) => Expect.fail('should not get here'), - onError: (Object asyncError) { - Expect.equals(value, asyncError); - count++; - asyncEnd(); - } - )); + futures.add(future.then((fValue) => Expect.fail('should not get here'), + onError: (Object asyncError) { + Expect.equals(value, asyncError); + count++; + asyncEnd(); + })); } main() { diff --git a/LibTest/async/DeferredLibrary/DeferredLibrary_A01_t01.dart b/LibTest/async/DeferredLibrary/DeferredLibrary_A01_t01.dart index e9b4863ac8..0c241149c7 100644 --- a/LibTest/async/DeferredLibrary/DeferredLibrary_A01_t01.dart +++ b/LibTest/async/DeferredLibrary/DeferredLibrary_A01_t01.dart @@ -16,14 +16,13 @@ import 'DeferredLibrary_A01_t01.lib.dart' deferred as lazy; void main() { try { lazy.method(); // foo is not loaded yet. - } on NoSuchMethodError catch(_) { - } + } on NoSuchMethodError catch (_) {} asyncStart(); lazy.loadLibrary().then(onFooLoaded); } void onFooLoaded(_) { - String name=lazy.method(); + String name = lazy.method(); Expect.equals('DeferredLibrary_A01_t01.lib', name); asyncEnd(); } diff --git a/LibTest/async/DeferredLibrary/DeferredLibrary_A01_t01.lib.dart b/LibTest/async/DeferredLibrary/DeferredLibrary_A01_t01.lib.dart index a3d75aac69..cbf2773d43 100644 --- a/LibTest/async/DeferredLibrary/DeferredLibrary_A01_t01.lib.dart +++ b/LibTest/async/DeferredLibrary/DeferredLibrary_A01_t01.lib.dart @@ -6,9 +6,8 @@ /// @description Checks that DeferredLibrary loads in lazy way. /// @author kaigorodov - library DeferredLibrary_A01_t01.lib; String method() { - return "DeferredLibrary_A01_t01.lib"; + return "DeferredLibrary_A01_t01.lib"; } diff --git a/LibTest/async/EventSink/EventSink_A01_t01.test.dart b/LibTest/async/EventSink/EventSink_A01_t01.test.dart index 8957dd83e7..76c2fca4fb 100644 --- a/LibTest/async/EventSink/EventSink_A01_t01.test.dart +++ b/LibTest/async/EventSink/EventSink_A01_t01.test.dart @@ -8,6 +8,7 @@ /// @author ngl@unipro.ru library EventSink_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -16,4 +17,3 @@ test(EventSink create()) { Expect.isTrue(es is EventSink); Expect.runtimeIsType(es); } - diff --git a/LibTest/async/EventSink/addError_A01_t01.test.dart b/LibTest/async/EventSink/addError_A01_t01.test.dart index e712f3b2ff..7ca71c4030 100644 --- a/LibTest/async/EventSink/addError_A01_t01.test.dart +++ b/LibTest/async/EventSink/addError_A01_t01.test.dart @@ -9,6 +9,7 @@ /// @author ngl@unipro.ru library addError_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -21,11 +22,9 @@ test(EventSink create()) { sc.stream.listen((value) { Expect.fail("Should not be here: $value"); - }, - onError: (error, StackTrace st) { + }, onError: (error, StackTrace st) { Expect.equals(values[i++], error); - }, - onDone: () { + }, onDone: () { asyncEnd(); }); @@ -36,4 +35,3 @@ test(EventSink create()) { sc.close(); } } - diff --git a/LibTest/async/EventSink/add_A01_t01.test.dart b/LibTest/async/EventSink/add_A01_t01.test.dart index 648b7d5b64..8dd4906d56 100644 --- a/LibTest/async/EventSink/add_A01_t01.test.dart +++ b/LibTest/async/EventSink/add_A01_t01.test.dart @@ -9,6 +9,7 @@ /// @author ngl@unipro.ru library add_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -21,11 +22,9 @@ test(EventSink create()) { sc.stream.listen((value) { Expect.equals(values[i++], value); - }, - onError: (error) { + }, onError: (error) { Expect.fail("Should not be here: $error"); - }, - onDone: () { + }, onDone: () { asyncEnd(); }); @@ -36,4 +35,3 @@ test(EventSink create()) { sc.close(); } } - diff --git a/LibTest/async/EventSink/all_tests.lib.dart b/LibTest/async/EventSink/all_tests.lib.dart index d999c86f91..f88a4e84fa 100644 --- a/LibTest/async/EventSink/all_tests.lib.dart +++ b/LibTest/async/EventSink/all_tests.lib.dart @@ -9,6 +9,7 @@ /// @author ngl@unipro.ru library all_tests_eventsink; + import "dart:async"; import "../../../Utils/expect.dart"; diff --git a/LibTest/async/EventSink/close_A01_t01.test.dart b/LibTest/async/EventSink/close_A01_t01.test.dart index 15726b87f8..456e1d7a55 100644 --- a/LibTest/async/EventSink/close_A01_t01.test.dart +++ b/LibTest/async/EventSink/close_A01_t01.test.dart @@ -10,6 +10,7 @@ /// @author ngl@unipro.ru library close_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -22,11 +23,9 @@ test(EventSink create()) { sc.stream.listen((value) { Expect.equals(values[i++], value); - }, - onError: (error, StackTrace st) { + }, onError: (error, StackTrace st) { Expect.equals(values[i++], error); - }, - onDone: () { + }, onDone: () { asyncEnd(); }); @@ -47,4 +46,3 @@ test(EventSink create()) { } } } - diff --git a/LibTest/async/EventSink/equality_operator_A01_t01.test.dart b/LibTest/async/EventSink/equality_operator_A01_t01.test.dart index 4babfad5b8..f26204b057 100644 --- a/LibTest/async/EventSink/equality_operator_A01_t01.test.dart +++ b/LibTest/async/EventSink/equality_operator_A01_t01.test.dart @@ -10,6 +10,7 @@ /// @author ngl@unipro.ru library equality_operator_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -21,4 +22,3 @@ test(EventSink create()) { Expect.isFalse(es1 == es2); Expect.isTrue(es1 == es3); } - diff --git a/LibTest/async/EventSink/hashCode_A01_t01.test.dart b/LibTest/async/EventSink/hashCode_A01_t01.test.dart index a4d4a281eb..8d2f8d69d3 100644 --- a/LibTest/async/EventSink/hashCode_A01_t01.test.dart +++ b/LibTest/async/EventSink/hashCode_A01_t01.test.dart @@ -14,6 +14,7 @@ /// @author ngl@unipro.ru library hashCode_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -33,4 +34,3 @@ test(EventSink create()) { Expect.isFalse(es1.hashCode == es3.hashCode); } } - diff --git a/LibTest/async/EventSink/noSuchMethodError_A01_t01.test.dart b/LibTest/async/EventSink/noSuchMethodError_A01_t01.test.dart index ca1ed0ea79..f24f765d49 100644 --- a/LibTest/async/EventSink/noSuchMethodError_A01_t01.test.dart +++ b/LibTest/async/EventSink/noSuchMethodError_A01_t01.test.dart @@ -11,6 +11,7 @@ /// @author ngl@unipro.ru library noSuchMethodError_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -18,14 +19,17 @@ test(EventSink create()) { dynamic es1 = create(); try { - es1.listen((_) {}); /// static type warning + es1.listen((_) {}); + + /// static type warning } catch (e) { Expect.isTrue(e is NoSuchMethodError); } try { - es1.abc((_) {}); /// static type warning + es1.abc((_) {}); + + /// static type warning } catch (e) { Expect.isTrue(e is NoSuchMethodError); } } - diff --git a/LibTest/async/EventSink/runtimeType_A01_t01.test.dart b/LibTest/async/EventSink/runtimeType_A01_t01.test.dart index 4276fc9a1a..f7ee7919be 100644 --- a/LibTest/async/EventSink/runtimeType_A01_t01.test.dart +++ b/LibTest/async/EventSink/runtimeType_A01_t01.test.dart @@ -9,6 +9,7 @@ /// @author ngl@unipro.ru library runtimeType_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -24,4 +25,3 @@ test(EventSink create()) { Expect.equals(es1.runtimeType, es2.runtimeType); Expect.notEquals(es1.runtimeType, o.runtimeType); } - diff --git a/LibTest/async/EventSink/toString_A01_t01.test.dart b/LibTest/async/EventSink/toString_A01_t01.test.dart index 019f648ad1..1528db4bc7 100644 --- a/LibTest/async/EventSink/toString_A01_t01.test.dart +++ b/LibTest/async/EventSink/toString_A01_t01.test.dart @@ -10,6 +10,7 @@ /// @author ngl@unipro.ru library toString_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -24,4 +25,3 @@ test(EventSink create()) { Expect.notEquals(es1, es2); Expect.equals(es1.toString(), es2.toString()); } - diff --git a/LibTest/async/Future/Future.delayed_A01_t01.dart b/LibTest/async/Future/Future.delayed_A01_t01.dart index f1c9739d52..488fda877e 100644 --- a/LibTest/async/Future/Future.delayed_A01_t01.dart +++ b/LibTest/async/Future/Future.delayed_A01_t01.dart @@ -16,11 +16,10 @@ import "../../../Utils/expect.dart"; void check(delay, value) { asyncStart(); - new Future.delayed(durationInMilliseconds(delay), () => value) - .then((v) { - Expect.equals(value, v); - asyncEnd(); - }); + new Future.delayed(durationInMilliseconds(delay), () => value).then((v) { + Expect.equals(value, v); + asyncEnd(); + }); } main() { diff --git a/LibTest/async/Future/Future.delayed_A01_t03.dart b/LibTest/async/Future/Future.delayed_A01_t03.dart index baf0875818..fc767fc98d 100644 --- a/LibTest/async/Future/Future.delayed_A01_t03.dart +++ b/LibTest/async/Future/Future.delayed_A01_t03.dart @@ -17,10 +17,11 @@ import "../../../Utils/expect.dart"; main() { bool computationStarted = false; asyncStart(); - new Future.delayed(Duration.zero, () {computationStarted = true;}) - .then((v) { - Expect.isTrue(computationStarted); - asyncEnd(); - }); + new Future.delayed(Duration.zero, () { + computationStarted = true; + }).then((v) { + Expect.isTrue(computationStarted); + asyncEnd(); + }); Expect.isFalse(computationStarted); } diff --git a/LibTest/async/Future/Future.delayed_A02_t01.dart b/LibTest/async/Future/Future.delayed_A02_t01.dart index 31d944441d..0a52a415e9 100644 --- a/LibTest/async/Future/Future.delayed_A02_t01.dart +++ b/LibTest/async/Future/Future.delayed_A02_t01.dart @@ -14,16 +14,14 @@ import "../../../Utils/expect.dart"; main() { asyncStart(); - new Future.delayed(Duration.zero) - .then((value) { - Expect.equals(null, value); - asyncEnd(); - }); + new Future.delayed(Duration.zero).then((value) { + Expect.equals(null, value); + asyncEnd(); + }); asyncStart(); - new Future.delayed(Duration.zero, null) - .then((value) { - Expect.equals(null, value); - asyncEnd(); - }); + new Future.delayed(Duration.zero, null).then((value) { + Expect.equals(null, value); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/Future.delayed_A03_t01.dart b/LibTest/async/Future/Future.delayed_A03_t01.dart index e3c02f47a6..205fdb3799 100644 --- a/LibTest/async/Future/Future.delayed_A03_t01.dart +++ b/LibTest/async/Future/Future.delayed_A03_t01.dart @@ -14,16 +14,14 @@ import "../../../Utils/expect.dart"; check(delay, value) { asyncStart(); - new Future.delayed(durationInMilliseconds(delay), () {throw value;}) - .then( - (v) { - Expect.fail("Created future should complete with error"); - }, - onError: (error) { - Expect.equals(value, error); - asyncEnd(); - } - ); + new Future.delayed(durationInMilliseconds(delay), () { + throw value; + }).then((v) { + Expect.fail("Created future should complete with error"); + }, onError: (error) { + Expect.equals(value, error); + asyncEnd(); + }); } main() { diff --git a/LibTest/async/Future/Future.error_A01_t01.dart b/LibTest/async/Future/Future.error_A01_t01.dart index deada1ab7b..4ebceac1e2 100644 --- a/LibTest/async/Future/Future.error_A01_t01.dart +++ b/LibTest/async/Future/Future.error_A01_t01.dart @@ -15,15 +15,14 @@ import "../../../Utils/expect.dart"; check(value) { asyncStart(); - new Future.error(value) - .catchError((error) { - if (value == null) { - Expect.isTrue(error is TypeError); - } else { - Expect.identical(value, error); - } - asyncEnd(); - }); + new Future.error(value).catchError((error) { + if (value == null) { + Expect.isTrue(error is TypeError); + } else { + Expect.identical(value, error); + } + asyncEnd(); + }); } main() { diff --git a/LibTest/async/Future/Future.error_A01_t02.dart b/LibTest/async/Future/Future.error_A01_t02.dart index 4e48374560..4d3a5ff7c3 100644 --- a/LibTest/async/Future/Future.error_A01_t02.dart +++ b/LibTest/async/Future/Future.error_A01_t02.dart @@ -20,7 +20,7 @@ main() { try { throw error; - } catch(e, st) { + } catch (e, st) { stackTrace = st; future = new Future.error(e, st); } diff --git a/LibTest/async/Future/Future.error_A01_t03.dart b/LibTest/async/Future/Future.error_A01_t03.dart index e4b76ba488..4fd1c67c8b 100644 --- a/LibTest/async/Future/Future.error_A01_t03.dart +++ b/LibTest/async/Future/Future.error_A01_t03.dart @@ -15,10 +15,9 @@ import "../../../Utils/expect.dart"; main() { bool inMain = true; asyncStart(); - new Future.error("@") - .catchError((_) { - Expect.isFalse(inMain); - asyncEnd(); - }); + new Future.error("@").catchError((_) { + Expect.isFalse(inMain); + asyncEnd(); + }); inMain = false; } diff --git a/LibTest/async/Future/Future.microtask_A01_t02.dart b/LibTest/async/Future/Future.microtask_A01_t02.dart index 112f98905b..87c5ad578f 100644 --- a/LibTest/async/Future/Future.microtask_A01_t02.dart +++ b/LibTest/async/Future/Future.microtask_A01_t02.dart @@ -19,15 +19,13 @@ main() { var value = [1, 2, 3]; asyncStart(); new Future.microtask(() { - bool b = true; - if (b) { + if (2 > 1) { throw value; } return 42; - }) - .catchError((e) { - Expect.identical(value, e); - asyncEnd(); - return 0; - }); + }).catchError((e) { + Expect.identical(value, e); + asyncEnd(); + return 0; + }); } diff --git a/LibTest/async/Future/Future.microtask_A01_t03.dart b/LibTest/async/Future/Future.microtask_A01_t03.dart index 9b1ea30a5e..99bde580bc 100644 --- a/LibTest/async/Future/Future.microtask_A01_t03.dart +++ b/LibTest/async/Future/Future.microtask_A01_t03.dart @@ -24,23 +24,19 @@ main() { asyncStart(2); - future - .then((x) { - Expect.isTrue(completer.isCompleted); - Expect.identical(value, x); - asyncEnd(); - }); - - future2.then( - (x) { - Expect.fail('created Future should complete with error'); - }, - onError: (x) { - Expect.isTrue(completer2.isCompleted); - Expect.identical(value, x); - asyncEnd(); - } - ); + future.then((x) { + Expect.isTrue(completer.isCompleted); + Expect.identical(value, x); + asyncEnd(); + }); + + future2.then((x) { + Expect.fail('created Future should complete with error'); + }, onError: (x) { + Expect.isTrue(completer2.isCompleted); + Expect.identical(value, x); + asyncEnd(); + }); completer.complete(value); completer2.completeError(value); diff --git a/LibTest/async/Future/Future.microtask_A01_t04.dart b/LibTest/async/Future/Future.microtask_A01_t04.dart index 684d8891b0..8dd4908271 100644 --- a/LibTest/async/Future/Future.microtask_A01_t04.dart +++ b/LibTest/async/Future/Future.microtask_A01_t04.dart @@ -16,9 +16,8 @@ main() { var value = [1, 2, 3]; asyncStart(); - new Future.microtask(() => value) - .then((x) { - Expect.identical(value, x); - asyncEnd(); - }); + new Future.microtask(() => value).then((x) { + Expect.identical(value, x); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/Future.sync_A01_t03.dart b/LibTest/async/Future/Future.sync_A01_t03.dart index 21db3c49b6..e3c813ab1d 100644 --- a/LibTest/async/Future/Future.sync_A01_t03.dart +++ b/LibTest/async/Future/Future.sync_A01_t03.dart @@ -19,25 +19,20 @@ import "dart:async"; import "../../../Utils/expect.dart"; check(value) { - asyncStart(); - - new Future.sync(() => throw value).then( - (_) { - Expect.fail("Created future should complete with error"); - }, - onError: (e) { - if (value == null){ - Expect.isTrue(e is TypeError); - } else { - Expect.identical(value, e); - } - asyncEnd(); + new Future.sync(() => throw value).then((_) { + Expect.fail("Created future should complete with error"); + }, onError: (e) { + if (value == null) { + Expect.isTrue(e is TypeError); + } else { + Expect.identical(value, e); } - ); + asyncEnd(); + }); } main() { - asyncStart(); + asyncStart(9); check(0); check(1); check(-5); @@ -47,5 +42,4 @@ main() { check(true); check(const []); check(const {'k1': 1, 'k2': 2}); - asyncEnd(); } diff --git a/LibTest/async/Future/Future.sync_A01_t04.dart b/LibTest/async/Future/Future.sync_A01_t04.dart index 71dd52a382..d8b9f2b9cd 100644 --- a/LibTest/async/Future/Future.sync_A01_t04.dart +++ b/LibTest/async/Future/Future.sync_A01_t04.dart @@ -29,23 +29,19 @@ main() { asyncStart(2); - future - .then((x) { - Expect.isTrue(completer.isCompleted); - Expect.identical(value, x); - asyncEnd(); - }); - - future2.then( - (_) { - Expect.fail("Created future should complete with error"); - }, - onError: (x) { - Expect.isTrue(completer2.isCompleted); - Expect.identical(value, x); - asyncEnd(); - } - ); + future.then((x) { + Expect.isTrue(completer.isCompleted); + Expect.identical(value, x); + asyncEnd(); + }); + + future2.then((_) { + Expect.fail("Created future should complete with error"); + }, onError: (x) { + Expect.isTrue(completer2.isCompleted); + Expect.identical(value, x); + asyncEnd(); + }); completer.complete(value); completer2.completeError(value); diff --git a/LibTest/async/Future/Future.value_A01_t01.dart b/LibTest/async/Future/Future.value_A01_t01.dart index ecce9dea95..369c3e1843 100644 --- a/LibTest/async/Future/Future.value_A01_t01.dart +++ b/LibTest/async/Future/Future.value_A01_t01.dart @@ -15,12 +15,10 @@ import "../../../Utils/expect.dart"; check(value) { asyncStart(); - new Future.value(value).then( - (x) { - Expect.equals(value, x); - asyncEnd(); - } - ); + new Future.value(value).then((x) { + Expect.equals(value, x); + asyncEnd(); + }); } main() { diff --git a/LibTest/async/Future/Future_A01_t02.dart b/LibTest/async/Future/Future_A01_t02.dart index a3ad5613a5..958ebb73e2 100644 --- a/LibTest/async/Future/Future_A01_t02.dart +++ b/LibTest/async/Future/Future_A01_t02.dart @@ -25,9 +25,8 @@ main() { asyncStart(); Future future = new Future(() => throw value); - future - .catchError((e) { - Expect.identical(value, e); - asyncEnd(); - }); + future.catchError((e) { + Expect.identical(value, e); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/Future_A01_t03.dart b/LibTest/async/Future/Future_A01_t03.dart index f618e1173b..534ddb25bd 100644 --- a/LibTest/async/Future/Future_A01_t03.dart +++ b/LibTest/async/Future/Future_A01_t03.dart @@ -26,20 +26,15 @@ main() { Future future = new Future(() => new Future.value(value)); Future future2 = new Future(() => new Future.error(value)); - future.then( - (x) { - Expect.identical(value, x); - asyncEnd(); - } - ); + future.then((x) { + Expect.identical(value, x); + asyncEnd(); + }); - future2.then( - (_) { - Expect.fail("Created future should complete with error"); - }, - onError: (x) { - Expect.identical(value, x); - asyncEnd(); - } - ); + future2.then((_) { + Expect.fail("Created future should complete with error"); + }, onError: (x) { + Expect.identical(value, x); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/Future_A01_t04.dart b/LibTest/async/Future/Future_A01_t04.dart index e9052356a5..10af9b712d 100644 --- a/LibTest/async/Future/Future_A01_t04.dart +++ b/LibTest/async/Future/Future_A01_t04.dart @@ -25,9 +25,8 @@ main() { asyncStart(); Future future = new Future(() => value); - future - .then((x) { - Expect.identical(value, x); - asyncEnd(); - }); + future.then((x) { + Expect.identical(value, x); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/asStream_A01_t02.dart b/LibTest/async/Future/asStream_A01_t02.dart index 8eda3f4432..c9511665f4 100644 --- a/LibTest/async/Future/asStream_A01_t02.dart +++ b/LibTest/async/Future/asStream_A01_t02.dart @@ -14,18 +14,17 @@ import "../../../Utils/expect.dart"; main() { Error error = new Error(); - Future future = new Future.sync(() {throw error;}); + Future future = new Future.sync(() { + throw error; + }); Stream stream = future.asStream(); Future f2 = stream.single; asyncStart(); - f2.then( - (fValue) { - Expect.fail("unexpected value=$fValue"); - }, - onError: (Object e){ - Expect.identical(error, e); - asyncEnd(); - } - ); + f2.then((fValue) { + Expect.fail("unexpected value=$fValue"); + }, onError: (Object e) { + Expect.identical(error, e); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/asStream_A02_t01.dart b/LibTest/async/Future/asStream_A02_t01.dart index c01d9eb92a..0e9170a335 100644 --- a/LibTest/async/Future/asStream_A02_t01.dart +++ b/LibTest/async/Future/asStream_A02_t01.dart @@ -16,18 +16,17 @@ String output1 = ""; main() { var value = 99; - Future future = new Future.sync(()=>value); + Future future = new Future.sync(() => value); Stream stream = future.asStream(); int count = 1; asyncStart(); - stream.listen( - (var event){ // should be invoked first - count = count + 1; - }, - onDone: () { - Expect.equals(2, count); - asyncEnd(); - } // should be invoked second - ); + stream.listen((var event) { + // should be invoked first + count = count + 1; + }, onDone: () { + Expect.equals(2, count); + asyncEnd(); + } // should be invoked second + ); } diff --git a/LibTest/async/Future/asStream_A02_t02.dart b/LibTest/async/Future/asStream_A02_t02.dart index f0d79949bb..a13f6500e9 100644 --- a/LibTest/async/Future/asStream_A02_t02.dart +++ b/LibTest/async/Future/asStream_A02_t02.dart @@ -23,12 +23,13 @@ main() { int count = 1; asyncStart(); - stream.listen( - (var event) {count = count + 1;}, // should be invoked first - onDone: (){ - Expect.equals(2, count); - Expect.isTrue(completer.isCompleted); - asyncEnd(); - } // should be invoked second - ); + stream.listen((var event) { + count = count + 1; + }, // should be invoked first + onDone: () { + Expect.equals(2, count); + Expect.isTrue(completer.isCompleted); + asyncEnd(); + } // should be invoked second + ); } diff --git a/LibTest/async/Future/catchError_A01_t01.dart b/LibTest/async/Future/catchError_A01_t01.dart index 6414250f07..73955a6560 100644 --- a/LibTest/async/Future/catchError_A01_t01.dart +++ b/LibTest/async/Future/catchError_A01_t01.dart @@ -15,7 +15,7 @@ import "../../../Utils/expect.dart"; void onError(Object asyncError) {} -void check (Future f1) { +void check(Future f1) { Object f2 = f1.catchError(onError); Expect.isTrue(f2 is Future); Expect.isFalse(identical(f1, f2)); @@ -24,5 +24,7 @@ void check (Future f1) { main() { check(new Completer().future); check(new Future.sync(() => 1)); - check(new Future.sync(() {throw 1;})); + check(new Future.sync(() { + throw 1; + })); } diff --git a/LibTest/async/Future/catchError_A03_t01.dart b/LibTest/async/Future/catchError_A03_t01.dart index c41c47089b..11b91e1277 100644 --- a/LibTest/async/Future/catchError_A03_t01.dart +++ b/LibTest/async/Future/catchError_A03_t01.dart @@ -23,22 +23,17 @@ main() { Future f = completer.future; List log = []; - f.catchError( - (Object error) { - log.add(2); - log.add(error); - }, - test: (Object error) { - log.add(1); - log.add(error); - return true; - } - ).then( - (_) { - Expect.listEquals([1, "!", 2, "!"], log); - asyncEnd(); - } - ); + f.catchError((Object error) { + log.add(2); + log.add(error); + }, test: (Object error) { + log.add(1); + log.add(error); + return true; + }).then((_) { + Expect.listEquals([1, "!", 2, "!"], log); + asyncEnd(); + }); asyncStart(); completer.completeError("!"); diff --git a/LibTest/async/Future/catchError_A03_t02.dart b/LibTest/async/Future/catchError_A03_t02.dart index 9b3fba9cdc..7a6d14f87b 100644 --- a/LibTest/async/Future/catchError_A03_t02.dart +++ b/LibTest/async/Future/catchError_A03_t02.dart @@ -24,25 +24,19 @@ main() { List log = []; Object initialError = "!"; - future.catchError( - (Object error) { - log.add(2); - log.add(error); - }, - test: (Object error){ - log.add(1); - log.add(error); - return false; - } - ) - .catchError( - (Object error) { - Expect.listEquals([1, initialError], log); - Expect.identical(initialError, log[1]); - Expect.identical(initialError, error); - asyncEnd(); - } - ); + future.catchError((Object error) { + log.add(2); + log.add(error); + }, test: (Object error) { + log.add(1); + log.add(error); + return false; + }).catchError((Object error) { + Expect.listEquals([1, initialError], log); + Expect.identical(initialError, log[1]); + Expect.identical(initialError, error); + asyncEnd(); + }); asyncStart(); completer.completeError(initialError); diff --git a/LibTest/async/Future/catchError_A03_t03.dart b/LibTest/async/Future/catchError_A03_t03.dart index d6ee6a2a09..f12b111bc4 100644 --- a/LibTest/async/Future/catchError_A03_t03.dart +++ b/LibTest/async/Future/catchError_A03_t03.dart @@ -25,25 +25,18 @@ main() { asyncStart(); - new Future.error(error, stackTrace) - .catchError( - (Object e) { - log.add(2); - log.add(e); - }, - test: (Object e) { - log.add(1); - log.add(e); - return false; - } - ) - .catchError( - (Object e, StackTrace st) { - Expect.listEquals([1, error], log); - Expect.identical(error, log[1]); - Expect.identical(error, e); - Expect.identical(stackTrace, st); - asyncEnd(); - } - ); + new Future.error(error, stackTrace).catchError((Object e) { + log.add(2); + log.add(e); + }, test: (Object e) { + log.add(1); + log.add(e); + return false; + }).catchError((Object e, StackTrace st) { + Expect.listEquals([1, error], log); + Expect.identical(error, log[1]); + Expect.identical(error, e); + Expect.identical(stackTrace, st); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/catchError_A03_t04.dart b/LibTest/async/Future/catchError_A03_t04.dart index fd7e78a5a5..fb21b1380d 100644 --- a/LibTest/async/Future/catchError_A03_t04.dart +++ b/LibTest/async/Future/catchError_A03_t04.dart @@ -23,24 +23,19 @@ main() { Future f = completer.future; List log = []; - f.catchError( - (Object error) { - log.add(2); - log.add(error); - return "ok"; - }, - test:(Object error) { - log.add(1); - log.add(error); - return true; - } - ).then( - (value) { - Expect.listEquals([1, "!", 2, "!"], log); - Expect.equals("ok", value); - asyncEnd(); - } - ); + f.catchError((Object error) { + log.add(2); + log.add(error); + return "ok"; + }, test: (Object error) { + log.add(1); + log.add(error); + return true; + }).then((value) { + Expect.listEquals([1, "!", 2, "!"], log); + Expect.equals("ok", value); + asyncEnd(); + }); asyncStart(); completer.completeError("!"); diff --git a/LibTest/async/Future/catchError_A03_t05.dart b/LibTest/async/Future/catchError_A03_t05.dart index 218fe2d9f6..499ee3f29c 100644 --- a/LibTest/async/Future/catchError_A03_t05.dart +++ b/LibTest/async/Future/catchError_A03_t05.dart @@ -23,24 +23,18 @@ main() { List log = []; asyncStart(); StackTrace stackTrace = StackTrace.current; - new Future.error("!", stackTrace) - .catchError( - (Object e, StackTrace st) { - log.add(2); - log.add(e); - log.add(st); - return "ok"; - }, - test:(Object e) { - log.add(1); - log.add(e); - return true; - } - ).then( - (value) { - Expect.listEquals([1, "!", 2, "!", stackTrace], log); - Expect.equals("ok", value); - asyncEnd(); - } - ); + new Future.error("!", stackTrace).catchError((Object e, StackTrace st) { + log.add(2); + log.add(e); + log.add(st); + return "ok"; + }, test: (Object e) { + log.add(1); + log.add(e); + return true; + }).then((value) { + Expect.listEquals([1, "!", 2, "!", stackTrace], log); + Expect.equals("ok", value); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/catchError_A03_t06.dart b/LibTest/async/Future/catchError_A03_t06.dart index 02cf9d3023..1abfd93aeb 100644 --- a/LibTest/async/Future/catchError_A03_t06.dart +++ b/LibTest/async/Future/catchError_A03_t06.dart @@ -24,27 +24,21 @@ main() { Future f = completer.future; List log = []; - f.catchError( - (Object error) { - log.add(2); - log.add(error); - throw "@"; - }, - test:(Object error){ - log.add(1); - log.add(error); - return true; - } - ).then( - (value) { - Expect.fail("Returned future should complete with error"); - }, - onError: (Object e) { - Expect.listEquals([1, "!", 2, "!"], log); - Expect.equals("@", e); - asyncEnd(); - } - ); + f.catchError((Object error) { + log.add(2); + log.add(error); + throw "@"; + }, test: (Object error) { + log.add(1); + log.add(error); + return true; + }).then((value) { + Expect.fail("Returned future should complete with error"); + }, onError: (Object e) { + Expect.listEquals([1, "!", 2, "!"], log); + Expect.equals("@", e); + asyncEnd(); + }); asyncStart(); completer.completeError("!"); diff --git a/LibTest/async/Future/catchError_A04_t01.dart b/LibTest/async/Future/catchError_A04_t01.dart index 541d6cd7b2..d0f4a4d835 100644 --- a/LibTest/async/Future/catchError_A04_t01.dart +++ b/LibTest/async/Future/catchError_A04_t01.dart @@ -15,18 +15,13 @@ main() { Completer completer = new Completer(); Future f = completer.future; - f.catchError( - (Object error) { - Expect.equals("!", error); - return "@"; - } - ) - .then( - (var value){ - Expect.equals("@", value); - asyncEnd(); - } - ); + f.catchError((Object error) { + Expect.equals("!", error); + return "@"; + }).then((var value) { + Expect.equals("@", value); + asyncEnd(); + }); asyncStart(); completer.completeError("!"); diff --git a/LibTest/async/Future/catchError_A04_t02.dart b/LibTest/async/Future/catchError_A04_t02.dart index d6ee020bea..b63900e6c1 100644 --- a/LibTest/async/Future/catchError_A04_t02.dart +++ b/LibTest/async/Future/catchError_A04_t02.dart @@ -16,18 +16,12 @@ main() { asyncStart(); Error error = new Error(); StackTrace stackTrace = StackTrace.current; - new Future.error(error, stackTrace) - .catchError( - (Object e, StackTrace st) { - Expect.equals(error, e); - Expect.equals(stackTrace, st); - return "@"; - } - ) - .then( - (var value){ - Expect.equals("@", value); - asyncEnd(); - } - ); + new Future.error(error, stackTrace).catchError((Object e, StackTrace st) { + Expect.equals(error, e); + Expect.equals(stackTrace, st); + return "@"; + }).then((var value) { + Expect.equals("@", value); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/catchError_A04_t03.dart b/LibTest/async/Future/catchError_A04_t03.dart index 6b28b073d3..71f40d13eb 100644 --- a/LibTest/async/Future/catchError_A04_t03.dart +++ b/LibTest/async/Future/catchError_A04_t03.dart @@ -15,21 +15,15 @@ main() { Completer completer = new Completer(); Future f = completer.future; - f.catchError( - (Object error) { - Expect.equals("!", error); - throw "@"; - } - ) - .then( - (var value){ - Expect.fail("returned future should complete with error"); - }, - onError: (Object error){ - Expect.equals("@", error); - asyncEnd(); - } - ); + f.catchError((Object error) { + Expect.equals("!", error); + throw "@"; + }).then((var value) { + Expect.fail("returned future should complete with error"); + }, onError: (Object error) { + Expect.equals("@", error); + asyncEnd(); + }); asyncStart(); completer.completeError("!"); diff --git a/LibTest/async/Future/catchError_A05_t01.dart b/LibTest/async/Future/catchError_A05_t01.dart index d3a99c3992..e492977f70 100644 --- a/LibTest/async/Future/catchError_A05_t01.dart +++ b/LibTest/async/Future/catchError_A05_t01.dart @@ -14,23 +14,15 @@ import "../../../Utils/expect.dart"; main() { asyncStart(); - new Future.error("!") - .catchError( - (Object error) { - Expect.fail("The onError should not be executed, if test throws"); - }, - test:(Object error){ - Expect.equals("!", error); - throw "@"; - } - ) - .then( - (var value) { - Expect.fail("returned future should complete with error"); - }, - onError: (Object error){ - Expect.equals("@", error); - asyncEnd(); - } - ); + new Future.error("!").catchError((Object error) { + Expect.fail("The onError should not be executed, if test throws"); + }, test: (Object error) { + Expect.equals("!", error); + throw "@"; + }).then((var value) { + Expect.fail("returned future should complete with error"); + }, onError: (Object error) { + Expect.equals("@", error); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/catchError_A06_t01.dart b/LibTest/async/Future/catchError_A06_t01.dart index 6aff9bf05c..0164f3a5a8 100644 --- a/LibTest/async/Future/catchError_A06_t01.dart +++ b/LibTest/async/Future/catchError_A06_t01.dart @@ -27,20 +27,15 @@ check(value) { asyncStart(2); - f.catchError( - (exception) { - asyncEnd(); - } - ); - - f.then( - (fValue) { - Expect.fail("Error is expected"); - }, - onError:(Object asyncError){ - asyncEnd(); - } - ); + f.catchError((exception) { + asyncEnd(); + }); + + f.then((fValue) { + Expect.fail("Error is expected"); + }, onError: (Object asyncError) { + asyncEnd(); + }); completer.completeError(value); } diff --git a/LibTest/async/Future/catchError_A07_t01.dart b/LibTest/async/Future/catchError_A07_t01.dart index a88589b99c..c9af6ed0db 100644 --- a/LibTest/async/Future/catchError_A07_t01.dart +++ b/LibTest/async/Future/catchError_A07_t01.dart @@ -25,7 +25,7 @@ f() { // With sound null safety, registering incompatible callback is synchronous // error, future ends up with no error handler that will lead to async // exception with error object equal to 1. - Expect.throws(() => new Future.error(1).catchError((x, y, z) {})); + Expect.throws(() => new Future.error(1).catchError((x, y, z) {})); } main() { diff --git a/LibTest/async/Future/doWhile_A01_t01.dart b/LibTest/async/Future/doWhile_A01_t01.dart index 8af937114b..ef15fbcdc0 100644 --- a/LibTest/async/Future/doWhile_A01_t01.dart +++ b/LibTest/async/Future/doWhile_A01_t01.dart @@ -27,10 +27,8 @@ main() { } asyncStart(); - Future.doWhile(f).then( - (_) { - Expect.equals(N, num); - asyncEnd(); - } - ); + Future.doWhile(f).then((_) { + Expect.equals(N, num); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/doWhile_A01_t02.dart b/LibTest/async/Future/doWhile_A01_t02.dart index 481309be15..8aa86df488 100644 --- a/LibTest/async/Future/doWhile_A01_t02.dart +++ b/LibTest/async/Future/doWhile_A01_t02.dart @@ -26,10 +26,8 @@ main() { } asyncStart(); - Future.doWhile(f).then( - (_) { - Expect.equals(N, num); - asyncEnd(); - } - ); + Future.doWhile(f).then((_) { + Expect.equals(N, num); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/doWhile_A01_t03.dart b/LibTest/async/Future/doWhile_A01_t03.dart index 42a6d1f8f5..a5f8652601 100644 --- a/LibTest/async/Future/doWhile_A01_t03.dart +++ b/LibTest/async/Future/doWhile_A01_t03.dart @@ -31,10 +31,8 @@ main() { } asyncStart(); - Future.doWhile(f).then( - (_) { - Expect.equals(N, num); - asyncEnd(); - } - ); + Future.doWhile(f).then((_) { + Expect.equals(N, num); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/doWhile_A02_t01.dart b/LibTest/async/Future/doWhile_A02_t01.dart index 2e1404f0bc..2841c2235f 100644 --- a/LibTest/async/Future/doWhile_A02_t01.dart +++ b/LibTest/async/Future/doWhile_A02_t01.dart @@ -27,14 +27,11 @@ main() { } asyncStart(); - Future.doWhile(f).then( - (_) { - Expect.fail("Returned future should fail with error"); - }, - onError: (e) { - Expect.equals(2, num); - Expect.equals(5, e); - asyncEnd(); - } - ); + Future.doWhile(f).then((_) { + Expect.fail("Returned future should fail with error"); + }, onError: (e) { + Expect.equals(2, num); + Expect.equals(5, e); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/doWhile_A02_t02.dart b/LibTest/async/Future/doWhile_A02_t02.dart index b12b82760a..3122a87f09 100644 --- a/LibTest/async/Future/doWhile_A02_t02.dart +++ b/LibTest/async/Future/doWhile_A02_t02.dart @@ -27,14 +27,11 @@ main() { } asyncStart(); - Future.doWhile(f).then( - (_) { - Expect.fail("Returned future should fail with error"); - }, - onError: (e) { - Expect.equals(2, num); - Expect.equals("@", e); - asyncEnd(); - } - ); + Future.doWhile(f).then((_) { + Expect.fail("Returned future should fail with error"); + }, onError: (e) { + Expect.equals(2, num); + Expect.equals("@", e); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/doWhile_A02_t03.dart b/LibTest/async/Future/doWhile_A02_t03.dart index bcdcb4390c..bb2025b394 100644 --- a/LibTest/async/Future/doWhile_A02_t03.dart +++ b/LibTest/async/Future/doWhile_A02_t03.dart @@ -29,13 +29,10 @@ main() { } asyncStart(); - Future.doWhile(f).then( - (_) { - Expect.fail("Returned future should fail with error"); - }, - onError: (e) { - Expect.equals(2, num); - asyncEnd(); - } - ); + Future.doWhile(f).then((_) { + Expect.fail("Returned future should fail with error"); + }, onError: (e) { + Expect.equals(2, num); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/doWhile_A05_t01.dart b/LibTest/async/Future/doWhile_A05_t01.dart index 7ad0a484ed..64ac5f11dc 100644 --- a/LibTest/async/Future/doWhile_A05_t01.dart +++ b/LibTest/async/Future/doWhile_A05_t01.dart @@ -25,10 +25,8 @@ main() { } asyncStart(); - Future.doWhile(f).then( - (_) { - Expect.equals(N, num); - asyncEnd(); - } - ); + Future.doWhile(f).then((_) { + Expect.equals(N, num); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/forEach_A01_t02.dart b/LibTest/async/Future/forEach_A01_t02.dart index 19d484e75e..5b23f92469 100644 --- a/LibTest/async/Future/forEach_A01_t02.dart +++ b/LibTest/async/Future/forEach_A01_t02.dart @@ -27,7 +27,7 @@ void check(List input) { } asyncStart(); - List expected = input.expand((e)=>["start", e, "finish"]).toList(); + List expected = input.expand((e) => ["start", e, "finish"]).toList(); Future.forEach(input, f).then((_) { Expect.listEquals(expected, log); asyncEnd(); diff --git a/LibTest/async/Future/forEach_A01_t03.dart b/LibTest/async/Future/forEach_A01_t03.dart index c09ba99d70..3a3910fedb 100644 --- a/LibTest/async/Future/forEach_A01_t03.dart +++ b/LibTest/async/Future/forEach_A01_t03.dart @@ -22,12 +22,10 @@ void check(List input) { } asyncStart(); - Future.forEach(input, f).then( - (_) { - Expect.listEquals(input, log); - asyncEnd(); - } - ); + Future.forEach(input, f).then((_) { + Expect.listEquals(input, log); + asyncEnd(); + }); } main() { diff --git a/LibTest/async/Future/forEach_A02_t01.dart b/LibTest/async/Future/forEach_A02_t01.dart index 53d6ee38d6..02088ef0c8 100644 --- a/LibTest/async/Future/forEach_A02_t01.dart +++ b/LibTest/async/Future/forEach_A02_t01.dart @@ -11,7 +11,7 @@ import "dart:async"; import "../../../Utils/expect.dart"; -void check(List input){ +void check(List input) { List c = new List.generate(input.length, (_) => new Completer()); int k = 0; @@ -20,12 +20,10 @@ void check(List input){ } asyncStart(); - Future.forEach(input, f).then( - (_) { - Expect.isTrue(c.fold(true, (bool v, Completer x) => v && x.isCompleted)); - asyncEnd(); - } - ); + Future.forEach(input, f).then((_) { + Expect.isTrue(c.fold(true, (bool v, Completer x) => v && x.isCompleted)); + asyncEnd(); + }); // complete the futures in reverse order c.reversed.forEach((Completer x) => x.complete(null)); } diff --git a/LibTest/async/Future/forEach_A03_t01.dart b/LibTest/async/Future/forEach_A03_t01.dart index f825b1e6c8..ecd1611f34 100644 --- a/LibTest/async/Future/forEach_A03_t01.dart +++ b/LibTest/async/Future/forEach_A03_t01.dart @@ -12,7 +12,7 @@ import "dart:async"; import "../../../Utils/expect.dart"; -List input = [0,1,2,3,4]; +List input = [0, 1, 2, 3, 4]; int e2stop = 2; main() { @@ -20,7 +20,7 @@ main() { dynamic f(int element) { if (element == e2stop) { - throw element; + throw element; } operationTrace[element] = true; return new Future.sync(() => element); diff --git a/LibTest/async/Future/forEach_A03_t02.dart b/LibTest/async/Future/forEach_A03_t02.dart index 59ba4f3b07..f20bd1c197 100644 --- a/LibTest/async/Future/forEach_A03_t02.dart +++ b/LibTest/async/Future/forEach_A03_t02.dart @@ -17,13 +17,13 @@ main() { dynamic f(element) { log.add(element); - return element==2 ? new Future.error("@") : new Future.value(null); + return element == 2 ? new Future.error("@") : new Future.value(null); } asyncStart(); - Future.forEach([0,1,2,3,4], f).catchError((Object error) { + Future.forEach([0, 1, 2, 3, 4], f).catchError((Object error) { Expect.equals("@", error); - Expect.listEquals([0,1,2], log); + Expect.listEquals([0, 1, 2], log); asyncEnd(); }); } diff --git a/LibTest/async/Future/then_A01_t02.dart b/LibTest/async/Future/then_A01_t02.dart index 4247bce582..8917467dcc 100644 --- a/LibTest/async/Future/then_A01_t02.dart +++ b/LibTest/async/Future/then_A01_t02.dart @@ -39,6 +39,6 @@ main() { check('value'); check(true); check(const {}); - check(const C()); + check(const C()); asyncEnd(); } diff --git a/LibTest/async/Future/then_A02_t01.dart b/LibTest/async/Future/then_A02_t01.dart index 885d48289d..e4a206210e 100644 --- a/LibTest/async/Future/then_A02_t01.dart +++ b/LibTest/async/Future/then_A02_t01.dart @@ -18,19 +18,14 @@ main() { Error error = new Error(); Completer completer = new Completer(); asyncStart(); - completer.future.then( - (_) { - throw error; - } - ).then( - (_) { - Expect.fail("Returned future should complete with error"); - }, - onError: (e) { - Expect.identical(error, e); - asyncEnd(); - } - ); + completer.future.then((_) { + throw error; + }).then((_) { + Expect.fail("Returned future should complete with error"); + }, onError: (e) { + Expect.identical(error, e); + asyncEnd(); + }); completer.complete("go"); } diff --git a/LibTest/async/Future/then_A02_t02.dart b/LibTest/async/Future/then_A02_t02.dart index f1e7746f67..47723a7c6b 100644 --- a/LibTest/async/Future/then_A02_t02.dart +++ b/LibTest/async/Future/then_A02_t02.dart @@ -18,22 +18,16 @@ main() { Error error = new Error(); Completer completer = new Completer(); asyncStart(); - completer.future.then( - (_) { - Expect.fail("Initial future should complete with error"); - }, - onError: (_) { - throw error; - } - ).then( - (_) { - Expect.fail("Returned future should complete with error"); - }, - onError: (e) { - Expect.identical(error, e); - asyncEnd(); - } - ); + completer.future.then((_) { + Expect.fail("Initial future should complete with error"); + }, onError: (_) { + throw error; + }).then((_) { + Expect.fail("Returned future should complete with error"); + }, onError: (e) { + Expect.identical(error, e); + asyncEnd(); + }); completer.completeError("go"); } diff --git a/LibTest/async/Future/then_A02_t03.dart b/LibTest/async/Future/then_A02_t03.dart index c4a02d7356..ceb4902a71 100644 --- a/LibTest/async/Future/then_A02_t03.dart +++ b/LibTest/async/Future/then_A02_t03.dart @@ -19,21 +19,15 @@ main() { asyncStart(); Error error = new Error(); StackTrace stackTrace = StackTrace.current; - new Future.error(error, stackTrace).then( - (_) { - Expect.fail("Initial future should complete with error"); - }, - onError: (_) { - throw error; - } - ).then( - (_) { - Expect.fail("Returned future should complete with error"); - }, - onError: (e, st) { - Expect.identical(error, e); - Expect.identical(stackTrace, st); - asyncEnd(); - } - ); + new Future.error(error, stackTrace).then((_) { + Expect.fail("Initial future should complete with error"); + }, onError: (_) { + throw error; + }).then((_) { + Expect.fail("Returned future should complete with error"); + }, onError: (e, st) { + Expect.identical(error, e); + Expect.identical(stackTrace, st); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/then_A03_t01.dart b/LibTest/async/Future/then_A03_t01.dart index 29ada75296..c51cc97e47 100644 --- a/LibTest/async/Future/then_A03_t01.dart +++ b/LibTest/async/Future/then_A03_t01.dart @@ -14,16 +14,12 @@ import "../../../Utils/expect.dart"; check(Object value) { asyncStart(); - new Future.value("1").then( - (_) { - return new Future.value(value); - } - ).then( - (v) { - Expect.identical(value, v); - asyncEnd(); - } - ); + new Future.value("1").then((_) { + return new Future.value(value); + }).then((v) { + Expect.identical(value, v); + asyncEnd(); + }); } main() { diff --git a/LibTest/async/Future/then_A04_t01.dart b/LibTest/async/Future/then_A04_t01.dart index ab4dea70fd..63e8739255 100644 --- a/LibTest/async/Future/then_A04_t01.dart +++ b/LibTest/async/Future/then_A04_t01.dart @@ -12,22 +12,16 @@ import "dart:async"; import "../../../Utils/expect.dart"; - void check(Object value) { asyncStart(); - new Future.error(value).then( - (_) { - Expect.fail("Initial future should complete with error"); - } - ).then( - (_) { - Expect.fail("Returned future should complete with error"); - }, - onError: (error) { - Expect.equals(value, error); - asyncEnd(); - } - ); + new Future.error(value).then((_) { + Expect.fail("Initial future should complete with error"); + }).then((_) { + Expect.fail("Returned future should complete with error"); + }, onError: (error) { + Expect.equals(value, error); + asyncEnd(); + }); } main() { diff --git a/LibTest/async/Future/then_A05_t02.dart b/LibTest/async/Future/then_A05_t02.dart index 1e8c60c803..8630e0246f 100644 --- a/LibTest/async/Future/then_A05_t02.dart +++ b/LibTest/async/Future/then_A05_t02.dart @@ -24,7 +24,7 @@ main() { try { throw error; - } catch(e, st) { + } catch (e, st) { stackTrace = st; future = new Future.error(e, st); } diff --git a/LibTest/async/Future/timeout_A01_t01.dart b/LibTest/async/Future/timeout_A01_t01.dart index c53acfc6ff..85e68d090a 100644 --- a/LibTest/async/Future/timeout_A01_t01.dart +++ b/LibTest/async/Future/timeout_A01_t01.dart @@ -18,12 +18,10 @@ import "../../../Utils/expect.dart"; check(var value) { asyncStart(); Future future = new Future.value(value); - future.timeout(new Duration(milliseconds:1)).then( - (v) { - Expect.identical(value, v); - asyncEnd(); - } - ); + future.timeout(new Duration(milliseconds: 1)).then((v) { + Expect.identical(value, v); + asyncEnd(); + }); } main() { diff --git a/LibTest/async/Future/timeout_A02_t01.dart b/LibTest/async/Future/timeout_A02_t01.dart index 830daa631e..34672f27a8 100644 --- a/LibTest/async/Future/timeout_A02_t01.dart +++ b/LibTest/async/Future/timeout_A02_t01.dart @@ -22,13 +22,11 @@ import "../../../Utils/expect.dart"; main() { asyncStart(); Completer completer = new Completer(); - completer.future.timeout( - new Duration(microseconds:1), - onTimeout: () => new Future.value(55) - ).then( - (value) { - Expect.equals(55, value); - asyncEnd(); - } - ); + completer.future + .timeout(new Duration(microseconds: 1), + onTimeout: () => new Future.value(55)) + .then((value) { + Expect.equals(55, value); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/timeout_A02_t02.dart b/LibTest/async/Future/timeout_A02_t02.dart index 07b66ebffd..ad242598e7 100644 --- a/LibTest/async/Future/timeout_A02_t02.dart +++ b/LibTest/async/Future/timeout_A02_t02.dart @@ -22,13 +22,10 @@ import "../../../Utils/expect.dart"; main() { asyncStart(); Completer completer = new Completer(); - completer.future.timeout( - new Duration(microseconds:1), - onTimeout: () => 56 - ).then( - (value) { - Expect.equals(56, value); - asyncEnd(); - } - ); + completer.future + .timeout(new Duration(microseconds: 1), onTimeout: () => 56) + .then((value) { + Expect.equals(56, value); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/timeout_A02_t03.dart b/LibTest/async/Future/timeout_A02_t03.dart index 0c9e312a5e..61b4d3c3eb 100644 --- a/LibTest/async/Future/timeout_A02_t03.dart +++ b/LibTest/async/Future/timeout_A02_t03.dart @@ -22,16 +22,12 @@ main() { Error error = new Error(); asyncStart(); Completer completer = new Completer(); - completer.future.timeout( - new Duration(microseconds:1), - onTimeout: () => throw error - ).then( - (_) { - Expect.fail("Returned future should complete with error"); - }, - onError: (e) { - Expect.identical(error, e); - asyncEnd(); - } - ); + completer.future + .timeout(new Duration(microseconds: 1), onTimeout: () => throw error) + .then((_) { + Expect.fail("Returned future should complete with error"); + }, onError: (e) { + Expect.identical(error, e); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/timeout_A03_t01.dart b/LibTest/async/Future/timeout_A03_t01.dart index f8ee123b70..46c87d16e1 100644 --- a/LibTest/async/Future/timeout_A03_t01.dart +++ b/LibTest/async/Future/timeout_A03_t01.dart @@ -19,15 +19,10 @@ import "../../../Utils/expect.dart"; main() { asyncStart(); Completer completer = new Completer(); - completer.future.timeout( - new Duration(microseconds:1) - ).then( - (_) { - Expect.fail("Returned future should complete with error"); - }, - onError: (e) { - Expect.isTrue(e is TimeoutException); - asyncEnd(); - } - ); + completer.future.timeout(new Duration(microseconds: 1)).then((_) { + Expect.fail("Returned future should complete with error"); + }, onError: (e) { + Expect.isTrue(e is TimeoutException); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/wait_A01_t01.dart b/LibTest/async/Future/wait_A01_t01.dart index 66f10d9290..f8ce8019ad 100644 --- a/LibTest/async/Future/wait_A01_t01.dart +++ b/LibTest/async/Future/wait_A01_t01.dart @@ -15,29 +15,24 @@ import "dart:async"; import "../../../Utils/expect.dart"; main() { - List completers = new List.generate(5, (_)=> new Completer()); + List completers = new List.generate(5, (_) => new Completer()); Iterable futures = completers.map((Completer c) => c.future); bool futureCompleted = false; asyncStart(); - Future.wait(futures).then( - (value) { - futureCompleted = true; - List expected = new List.generate(completers.length, (i) => i); - Expect.listEquals(expected, value); - asyncEnd(); - } - ); + Future.wait(futures).then((value) { + futureCompleted = true; + List expected = new List.generate(completers.length, (i) => i); + Expect.listEquals(expected, value); + asyncEnd(); + }); int i = 0; - new Timer.periodic( - durationInMilliseconds(50), - (Timer t){ - Expect.isFalse(futureCompleted); - completers[i].complete(i); - if (++i == completers.length) { - t.cancel(); - } - } - ); + new Timer.periodic(durationInMilliseconds(50), (Timer t) { + Expect.isFalse(futureCompleted); + completers[i].complete(i); + if (++i == completers.length) { + t.cancel(); + } + }); } diff --git a/LibTest/async/Future/wait_A01_t03.dart b/LibTest/async/Future/wait_A01_t03.dart index 018cd2fe76..b9a53092ac 100644 --- a/LibTest/async/Future/wait_A01_t03.dart +++ b/LibTest/async/Future/wait_A01_t03.dart @@ -28,11 +28,10 @@ main() { var future5 = completer5.future; asyncStart(); - Future.wait([future1, future2, future3, future4, future5]) - .then((value) { - Expect.listEquals([1, 2, 3, 4, 5], value); - asyncEnd(); - }); + Future.wait([future1, future2, future3, future4, future5]).then((value) { + Expect.listEquals([1, 2, 3, 4, 5], value); + asyncEnd(); + }); completer1.complete(1); completer2.complete(2); diff --git a/LibTest/async/Future/wait_A01_t04.dart b/LibTest/async/Future/wait_A01_t04.dart index 1effd1ef56..a23ebdf38b 100644 --- a/LibTest/async/Future/wait_A01_t04.dart +++ b/LibTest/async/Future/wait_A01_t04.dart @@ -17,16 +17,15 @@ import "../../../Utils/expect.dart"; const N = 5; main() { - List completers = new List.generate(5, (_)=> new Completer()); + List completers = new List.generate(5, (_) => new Completer()); Iterable futures = completers.map((Completer c) => c.future); int i = 0; completers.forEach((Completer c) => c.complete(i++)); asyncStart(); - Future.wait(futures) - .then((value) { - List expected = new List.generate(completers.length, (i) => i); - Expect.listEquals(expected, value); - asyncEnd(); - }); + Future.wait(futures).then((value) { + List expected = new List.generate(completers.length, (i) => i); + Expect.listEquals(expected, value); + asyncEnd(); + }); } diff --git a/LibTest/async/Future/wait_A02_t01.dart b/LibTest/async/Future/wait_A02_t01.dart index 1229c5616d..97d38f6a16 100644 --- a/LibTest/async/Future/wait_A02_t01.dart +++ b/LibTest/async/Future/wait_A02_t01.dart @@ -30,20 +30,17 @@ main() { var f = Future.wait([future1, future2, future3, future4, future5]); asyncStart(); - f.then( - (value) { - Expect.fail("Returned future should complete with error"); - }, - onError: (error) { - Expect.isTrue([1, 2, 3, 4, 5].contains(error), "error: $error"); - Expect.isTrue(completer1.isCompleted); - Expect.isTrue(completer2.isCompleted); - Expect.isTrue(completer3.isCompleted); - Expect.isTrue(completer4.isCompleted); - Expect.isTrue(completer5.isCompleted); - asyncEnd(); - } - ); + f.then((value) { + Expect.fail("Returned future should complete with error"); + }, onError: (error) { + Expect.isTrue([1, 2, 3, 4, 5].contains(error), "error: $error"); + Expect.isTrue(completer1.isCompleted); + Expect.isTrue(completer2.isCompleted); + Expect.isTrue(completer3.isCompleted); + Expect.isTrue(completer4.isCompleted); + Expect.isTrue(completer5.isCompleted); + asyncEnd(); + }); completer1.completeError(1); completer2.completeError(2); diff --git a/LibTest/async/Future/wait_A02_t02.dart b/LibTest/async/Future/wait_A02_t02.dart index a2bb0b5717..7313484b91 100644 --- a/LibTest/async/Future/wait_A02_t02.dart +++ b/LibTest/async/Future/wait_A02_t02.dart @@ -31,20 +31,17 @@ main() { var f = Future.wait([future1, future2, future3, future4, future5]); asyncStart(); - f.then( - (value) { - Expect.fail("Returned future should complete with error"); - }, - onError: (Object error) { - Expect.equals(1, error); - Expect.isTrue(completer1.isCompleted); - Expect.isTrue(completer2.isCompleted); - Expect.isTrue(completer3.isCompleted); - Expect.isTrue(completer4.isCompleted); - Expect.isTrue(completer5.isCompleted); - asyncEnd(); - } - ); + f.then((value) { + Expect.fail("Returned future should complete with error"); + }, onError: (Object error) { + Expect.equals(1, error); + Expect.isTrue(completer1.isCompleted); + Expect.isTrue(completer2.isCompleted); + Expect.isTrue(completer3.isCompleted); + Expect.isTrue(completer4.isCompleted); + Expect.isTrue(completer5.isCompleted); + asyncEnd(); + }); completer1.completeError(1); completer2.complete(2); diff --git a/LibTest/async/Future/wait_A03_t01.dart b/LibTest/async/Future/wait_A03_t01.dart index f897ae386e..17ec7af314 100644 --- a/LibTest/async/Future/wait_A03_t01.dart +++ b/LibTest/async/Future/wait_A03_t01.dart @@ -28,29 +28,24 @@ main() { var future4 = completer4.future; var future5 = completer5.future; - var f = Future.wait( - [future1, future2, future3, future4, future5], - eagerError: true - ); + var f = Future.wait([future1, future2, future3, future4, future5], + eagerError: true); asyncStart(); - f.then( - (value) { - Expect.fail("Returned future should complete with error"); - }, - onError: (Object error) { - Expect.equals(2, error); - Expect.isTrue(completer1.isCompleted); - Expect.isTrue(completer2.isCompleted); - Expect.isFalse(completer3.isCompleted); - Expect.isFalse(completer4.isCompleted); - Expect.isFalse(completer5.isCompleted); - completer3.complete(3); - completer4.complete(4); - completer5.complete(5); - asyncEnd(); - } - ); + f.then((value) { + Expect.fail("Returned future should complete with error"); + }, onError: (Object error) { + Expect.equals(2, error); + Expect.isTrue(completer1.isCompleted); + Expect.isTrue(completer2.isCompleted); + Expect.isFalse(completer3.isCompleted); + Expect.isFalse(completer4.isCompleted); + Expect.isFalse(completer5.isCompleted); + completer3.complete(3); + completer4.complete(4); + completer5.complete(5); + asyncEnd(); + }); completer1.complete(1); completer2.completeError(2); diff --git a/LibTest/async/Future/wait_A04_t01.dart b/LibTest/async/Future/wait_A04_t01.dart index 1db54bbd48..dec78b37d5 100644 --- a/LibTest/async/Future/wait_A04_t01.dart +++ b/LibTest/async/Future/wait_A04_t01.dart @@ -17,24 +17,21 @@ import "dart:async"; import "../../../Utils/expect.dart"; main() { - List completers = new List.generate(5, (_)=> new Completer()); + List completers = new List.generate(5, (_) => new Completer()); Iterable futures = completers.map((Completer c) => c.future); List successful = []; asyncStart(); Future.wait(futures, eagerError: false, cleanUp: (v) => successful.add(v)) - .then( - (_) { - Expect.fail("Returned future should complete with error"); - }, - onError: (Object error) { - Expect.isTrue(error == 1 || error == 2, "error: $error, expected 1 or 2"); - Expect.isTrue(completers.fold(true, (bool r, v) => r && v.isCompleted)); - successful.sort(); - Expect.listEquals([0, 3, 4], successful); - asyncEnd(); - } - ); + .then((_) { + Expect.fail("Returned future should complete with error"); + }, onError: (Object error) { + Expect.isTrue(error == 1 || error == 2, "error: $error, expected 1 or 2"); + Expect.isTrue(completers.fold(true, (bool r, v) => r && v.isCompleted)); + successful.sort(); + Expect.listEquals([0, 3, 4], successful); + asyncEnd(); + }); completers[0].complete(0); completers[1].completeError(1); diff --git a/LibTest/async/Future/wait_A04_t02.dart b/LibTest/async/Future/wait_A04_t02.dart index 0b4cb3bb44..d200cce9d2 100644 --- a/LibTest/async/Future/wait_A04_t02.dart +++ b/LibTest/async/Future/wait_A04_t02.dart @@ -23,19 +23,16 @@ main() { asyncStart(); Future.wait(futures, eagerError: true, cleanUp: (v) => successful.add(v)) - .then( - (_) { - Expect.fail("Returned future should complete with error"); - }, - onError: (Object error) { - Expect.equals(1, error); - Expect.isTrue(completers[0].isCompleted); - Expect.isTrue(completers[1].isCompleted); - Expect.isFalse(completers[4].isCompleted); - Expect.listEquals([0], successful); - asyncEnd(); - } - ); + .then((_) { + Expect.fail("Returned future should complete with error"); + }, onError: (Object error) { + Expect.equals(1, error); + Expect.isTrue(completers[0].isCompleted); + Expect.isTrue(completers[1].isCompleted); + Expect.isFalse(completers[4].isCompleted); + Expect.listEquals([0], successful); + asyncEnd(); + }); completers[0].complete(0); completers[1].completeError(1); diff --git a/LibTest/async/Future/whenComplete_A01_t01.dart b/LibTest/async/Future/whenComplete_A01_t01.dart index 68940b8a5b..a14174fc3e 100644 --- a/LibTest/async/Future/whenComplete_A01_t01.dart +++ b/LibTest/async/Future/whenComplete_A01_t01.dart @@ -29,4 +29,3 @@ main() { asyncStart(); completer2.completeError(22); } - diff --git a/LibTest/async/Future/whenComplete_A02_t01.dart b/LibTest/async/Future/whenComplete_A02_t01.dart index 2c97c8f009..218de6268c 100644 --- a/LibTest/async/Future/whenComplete_A02_t01.dart +++ b/LibTest/async/Future/whenComplete_A02_t01.dart @@ -29,4 +29,3 @@ main() { asyncEnd(); }); } - diff --git a/LibTest/async/Future/whenComplete_A02_t02.dart b/LibTest/async/Future/whenComplete_A02_t02.dart index 95f662bb54..1c546de86e 100644 --- a/LibTest/async/Future/whenComplete_A02_t02.dart +++ b/LibTest/async/Future/whenComplete_A02_t02.dart @@ -24,12 +24,10 @@ main() { asyncStart(); completer.completeError(value); - f.then( - (value2) { - Expect.fail("Returned future should complete with error"); - }, - onError: (error) { - Expect.equals(value, error); - asyncEnd(); + f.then((value2) { + Expect.fail("Returned future should complete with error"); + }, onError: (error) { + Expect.equals(value, error); + asyncEnd(); }); } diff --git a/LibTest/async/Future/whenComplete_A03_t01.dart b/LibTest/async/Future/whenComplete_A03_t01.dart index 345a73e4c3..5d8c39e8f9 100644 --- a/LibTest/async/Future/whenComplete_A03_t01.dart +++ b/LibTest/async/Future/whenComplete_A03_t01.dart @@ -16,18 +16,13 @@ main() { Completer completer = new Completer(); Future f0 = completer.future; - f0.whenComplete( - () { - throw value; - } - ).catchError( - (Object error) { - Expect.equals(value, error); - asyncEnd(); - } - ); + f0.whenComplete(() { + throw value; + }).catchError((Object error) { + Expect.equals(value, error); + asyncEnd(); + }); asyncStart(); completer.complete(0); } - diff --git a/LibTest/async/Future/whenComplete_A04_t01.dart b/LibTest/async/Future/whenComplete_A04_t01.dart index 6ed4fa01a9..0735bcd9e6 100644 --- a/LibTest/async/Future/whenComplete_A04_t01.dart +++ b/LibTest/async/Future/whenComplete_A04_t01.dart @@ -33,4 +33,3 @@ main() { completer2.complete(1); } - diff --git a/LibTest/async/Future/whenComplete_A04_t02.dart b/LibTest/async/Future/whenComplete_A04_t02.dart index 870c7896b6..e79b5304b0 100644 --- a/LibTest/async/Future/whenComplete_A04_t02.dart +++ b/LibTest/async/Future/whenComplete_A04_t02.dart @@ -21,21 +21,19 @@ main() { Future f0 = completer.future; Completer completer2 = new Completer(); Future f2 = completer2.future; - Future f = f0.whenComplete(() {return f2;}); + Future f = f0.whenComplete(() { + return f2; + }); asyncStart(); - f.then( - (var v) { - Expect.fail("Returned future should complete with error"); - }, - onError: (Object e) { - Expect.equals(value, e); - asyncEnd(); - } - ); + f.then((var v) { + Expect.fail("Returned future should complete with error"); + }, onError: (Object e) { + Expect.equals(value, e); + asyncEnd(); + }); completer.complete(1); completer2.completeError(value); } - diff --git a/LibTest/async/Stream/Stream.empty_A02_t01.dart b/LibTest/async/Stream/Stream.empty_A02_t01.dart index ee8abb021c..ba21112d68 100644 --- a/LibTest/async/Stream/Stream.empty_A02_t01.dart +++ b/LibTest/async/Stream/Stream.empty_A02_t01.dart @@ -16,12 +16,9 @@ import "../../../Utils/expect.dart"; main() { asyncStart(); - new Stream.empty().listen( - (_) { - Expect.fail("Created stream should be empty"); - }, - onDone: () { - asyncEnd(); - } - ); + new Stream.empty().listen((_) { + Expect.fail("Created stream should be empty"); + }, onDone: () { + asyncEnd(); + }); } diff --git a/LibTest/async/Stream/Stream.eventTransformed_A01_t01.dart b/LibTest/async/Stream/Stream.eventTransformed_A01_t01.dart index e5a027321c..11a5ce3816 100644 --- a/LibTest/async/Stream/Stream.eventTransformed_A01_t01.dart +++ b/LibTest/async/Stream/Stream.eventTransformed_A01_t01.dart @@ -28,6 +28,7 @@ class MySink implements EventSink { _sink.add(i * 2); } } + void addError(e, [st]) => _sink.addError(e, st); void close() => _sink.close(); } diff --git a/LibTest/async/Stream/Stream.eventTransformed_A01_t02.dart b/LibTest/async/Stream/Stream.eventTransformed_A01_t02.dart index 1eaf63b080..02fb3e339b 100644 --- a/LibTest/async/Stream/Stream.eventTransformed_A01_t02.dart +++ b/LibTest/async/Stream/Stream.eventTransformed_A01_t02.dart @@ -29,6 +29,7 @@ class MySink implements EventSink { _sink.add(i * 2); } } + void addError(e, [st]) => _sink.addError(e, st); void close() => _sink.close(); } @@ -36,7 +37,9 @@ class MySink implements EventSink { List input = [1, 2, 3, 4, 5]; main() { - Stream s = new Stream.fromIterable(input).map((x) {throw x;}); + Stream s = new Stream.fromIterable(input).map((x) { + throw x; + }); Stream s2 = new Stream.eventTransformed(s, (sink) => new MySink(sink)); AsyncExpect.events([], input, s2); diff --git a/LibTest/async/Stream/Stream.fromFuture_A02_t02.dart b/LibTest/async/Stream/Stream.fromFuture_A02_t02.dart index 78abacf35f..9fed817f65 100644 --- a/LibTest/async/Stream/Stream.fromFuture_A02_t02.dart +++ b/LibTest/async/Stream/Stream.fromFuture_A02_t02.dart @@ -15,11 +15,16 @@ import "../../../Utils/expect.dart"; main() { Error error = new Error(); // using immediate sync future - void throwError() {throw error;} - AsyncExpect.events([], [error], new Stream.fromFuture(new Future.sync(throwError))); + void throwError() { + throw error; + } + + AsyncExpect.events( + [], [error], new Stream.fromFuture(new Future.sync(throwError))); // using immediate future - AsyncExpect.events([], [error], new Stream.fromFuture(new Future(throwError))); + AsyncExpect.events( + [], [error], new Stream.fromFuture(new Future(throwError))); // using completable future Completer completer = new Completer(); diff --git a/LibTest/async/Stream/Stream.fromFutures_A01_t01.dart b/LibTest/async/Stream/Stream.fromFutures_A01_t01.dart index 95e04b3b28..aad400fd15 100644 --- a/LibTest/async/Stream/Stream.fromFutures_A01_t01.dart +++ b/LibTest/async/Stream/Stream.fromFutures_A01_t01.dart @@ -31,18 +31,14 @@ main() { asyncStart(); - s.listen( - (var event) { - Expect.equals(num++, event); - }, - onError: (_) { - Expect.fail("onError called unexpectedly"); - }, - onDone: () { - Expect.equals(N, num, "onDone"); - asyncEnd(); - } - ); + s.listen((var event) { + Expect.equals(num++, event); + }, onError: (_) { + Expect.fail("onError called unexpectedly"); + }, onDone: () { + Expect.equals(N, num, "onDone"); + asyncEnd(); + }); for (int k = 0; k < N; k++) { completers[k].complete(k); diff --git a/LibTest/async/Stream/Stream.fromFutures_A01_t02.dart b/LibTest/async/Stream/Stream.fromFutures_A01_t02.dart index 3bbe4d2598..3a5596e79b 100644 --- a/LibTest/async/Stream/Stream.fromFutures_A01_t02.dart +++ b/LibTest/async/Stream/Stream.fromFutures_A01_t02.dart @@ -32,18 +32,14 @@ main() { asyncStart(); - s.listen( - (var event) { - Expect.equals(f2c[num++], event); - }, - onError: (_) { - Expect.fail("onError called unexpectedly"); - }, - onDone: () { - Expect.equals(N, num, "onDone"); - asyncEnd(); - } - ); + s.listen((var event) { + Expect.equals(f2c[num++], event); + }, onError: (_) { + Expect.fail("onError called unexpectedly"); + }, onDone: () { + Expect.equals(N, num, "onDone"); + asyncEnd(); + }); for (int k = 0; k < N; k++) { completers[f2c[k]].complete(f2c[k]); diff --git a/LibTest/async/Stream/Stream.fromFutures_A02_t01.dart b/LibTest/async/Stream/Stream.fromFutures_A02_t01.dart index 4c1b47db3e..a60155d849 100644 --- a/LibTest/async/Stream/Stream.fromFutures_A02_t01.dart +++ b/LibTest/async/Stream/Stream.fromFutures_A02_t01.dart @@ -35,17 +35,13 @@ main() { List events = []; asyncStart(); - s.listen( - (var event) { - events.add(event); - }, - onError: (_) { - Expect.fail("onError called unexpectedly"); - }, - onDone: () { - events.sort(); - Expect.listEquals([0,1,2,3], events); - asyncEnd(); - } - ); + s.listen((var event) { + events.add(event); + }, onError: (_) { + Expect.fail("onError called unexpectedly"); + }, onDone: () { + events.sort(); + Expect.listEquals([0, 1, 2, 3], events); + asyncEnd(); + }); } diff --git a/LibTest/async/Stream/Stream.fromFutures_A02_t02.dart b/LibTest/async/Stream/Stream.fromFutures_A02_t02.dart index d3b7ea7c1c..21fa1c8820 100644 --- a/LibTest/async/Stream/Stream.fromFutures_A02_t02.dart +++ b/LibTest/async/Stream/Stream.fromFutures_A02_t02.dart @@ -35,19 +35,15 @@ main() { List events = []; asyncStart(); - s.listen( - (var event) { - events.add(event); - }, - onError: (_) { - Expect.fail("onError called unexpectedly"); - }, - onDone: () { - events.sort(); - Expect.listEquals([0,1,2,3], events); - asyncEnd(); - } - ); + s.listen((var event) { + events.add(event); + }, onError: (_) { + Expect.fail("onError called unexpectedly"); + }, onDone: () { + events.sort(); + Expect.listEquals([0, 1, 2, 3], events); + asyncEnd(); + }); for (int k = 0; k < N; k++) { if (k != 1) { diff --git a/LibTest/async/Stream/Stream.fromFutures_all_t01.dart b/LibTest/async/Stream/Stream.fromFutures_all_t01.dart index 5bddc1fd9c..cc40555867 100644 --- a/LibTest/async/Stream/Stream.fromFutures_all_t01.dart +++ b/LibTest/async/Stream/Stream.fromFutures_all_t01.dart @@ -16,10 +16,8 @@ import "dart:async"; import "allTests_A01.lib.dart" as all; -Stream create(Iterable data){ - return new Stream.fromFutures( - data.map((T x) => new Future.value(x)) - ); +Stream create(Iterable data) { + return new Stream.fromFutures(data.map((T x) => new Future.value(x))); } main() { diff --git a/LibTest/async/Stream/Stream.fromIterable_A01_t01.dart b/LibTest/async/Stream/Stream.fromIterable_A01_t01.dart index 0a66bd08de..0286319c49 100644 --- a/LibTest/async/Stream/Stream.fromIterable_A01_t01.dart +++ b/LibTest/async/Stream/Stream.fromIterable_A01_t01.dart @@ -7,7 +7,6 @@ /// @description Checks that created stream is single-subscription. /// @author kaigorodov - import "dart:async"; import "../../../Utils/expect.dart"; @@ -16,4 +15,3 @@ main() { Expect.isFalse(s.isBroadcast); } - diff --git a/LibTest/async/Stream/Stream.periodic_A02_t01.dart b/LibTest/async/Stream/Stream.periodic_A02_t01.dart index c3e1e89b22..512c7364b1 100644 --- a/LibTest/async/Stream/Stream.periodic_A02_t01.dart +++ b/LibTest/async/Stream/Stream.periodic_A02_t01.dart @@ -12,8 +12,8 @@ import "dart:async"; import "../../../Utils/expect.dart"; void check(int periodMs) { - Stream s = new Stream.periodic( - durationInMilliseconds(periodMs), (computationCount) => computationCount * periodMs); + Stream s = new Stream.periodic(durationInMilliseconds(periodMs), + (computationCount) => computationCount * periodMs); int count = 0; asyncStart(); StreamSubscription? subs; diff --git a/LibTest/async/Stream/Stream.periodic_all_t02.dart b/LibTest/async/Stream/Stream.periodic_all_t02.dart index e7f9f376d1..9d8df0a59b 100644 --- a/LibTest/async/Stream/Stream.periodic_all_t02.dart +++ b/LibTest/async/Stream/Stream.periodic_all_t02.dart @@ -12,24 +12,21 @@ import "dart:async"; import "allTests_A02.lib.dart" as all; -Stream create( - Iterable data, {bool isError(T x)?, required T defaultValue}) { +Stream create(Iterable data, + {bool isError(T x)?, required T defaultValue}) { int count = data.length; Iterator iterator = data.iterator; - return new Stream.periodic( - new Duration(milliseconds: 10), - (_) { - count--; - if (iterator.moveNext()) { - T x = iterator.current; - if (isError != null && isError(x) && count >= 0) { - throw x!; - } - return x; - } - return defaultValue; + return new Stream.periodic(new Duration(milliseconds: 10), (_) { + count--; + if (iterator.moveNext()) { + T x = iterator.current; + if (isError != null && isError(x) && count >= 0) { + throw x!; } - ).takeWhile((_) => count >= 0); + return x; + } + return defaultValue; + }).takeWhile((_) => count >= 0); } main() { diff --git a/LibTest/async/Stream/Stream_A01_t01.dart b/LibTest/async/Stream/Stream_A01_t01.dart index 8c61e2aaed..a4064cc876 100644 --- a/LibTest/async/Stream/Stream_A01_t01.dart +++ b/LibTest/async/Stream/Stream_A01_t01.dart @@ -11,35 +11,31 @@ import "dart:async"; class MyStreamSubscription implements StreamSubscription { @override Future asFuture([E? futureValue]) { - throw UnimplementedError(); + throw UnimplementedError(); } + @override Future cancel() { - throw UnimplementedError(); + throw UnimplementedError(); } + @override - void onData(void Function(T data)? handleData) { - } + void onData(void Function(T data)? handleData) {} @override - void onDone(void Function()? handleDone) { - } + void onDone(void Function()? handleDone) {} @override - void onError(Function? handleError) { - } + void onError(Function? handleError) {} @override - void pause([Future? resumeSignal]) { - } + void pause([Future? resumeSignal]) {} @override - void resume() { - } + void resume() {} @override bool get isPaused => throw UnimplementedError(); } class MyStream extends Stream { StreamSubscription listen(void onData(T event)?, - {Function? onError, void onDone()?, bool? cancelOnError}) - { + {Function? onError, void onDone()?, bool? cancelOnError}) { return new MyStreamSubscription(); } } diff --git a/LibTest/async/Stream/allTests_A01.lib.dart b/LibTest/async/Stream/allTests_A01.lib.dart index 82a6d64b2c..45714fc3c7 100644 --- a/LibTest/async/Stream/allTests_A01.lib.dart +++ b/LibTest/async/Stream/allTests_A01.lib.dart @@ -7,6 +7,7 @@ /// @author a.semenov@unipro.ru library allTests_A01; + import "../../../Utils/expect.dart"; import "any_A01_t01.test.dart" as any_A01_t01; @@ -48,7 +49,6 @@ import "distinct_A05_t01.test.dart" as distinct_A05_t01; import "drain_A02_t01.test.dart" as drain_A02_t01; import "drain_A02_t02.test.dart" as drain_A02_t02; - import "elementAt_A01_t01.test.dart" as elementAt_A01_t01; import "elementAt_A01_t02.test.dart" as elementAt_A01_t02; import "elementAt_A01_t03.test.dart" as elementAt_A01_t03; diff --git a/LibTest/async/Stream/allTests_A02.lib.dart b/LibTest/async/Stream/allTests_A02.lib.dart index c661969d0e..d2bb38c94b 100644 --- a/LibTest/async/Stream/allTests_A02.lib.dart +++ b/LibTest/async/Stream/allTests_A02.lib.dart @@ -7,6 +7,7 @@ /// @author a.semenov@unipro.ru library allTests_A02; + import "../../../Utils/expect.dart"; import "any_A02_t01.test.dart" as any_A02_t01; diff --git a/LibTest/async/Stream/allTests_A03.lib.dart b/LibTest/async/Stream/allTests_A03.lib.dart index cb14a88005..7f23e01cb6 100644 --- a/LibTest/async/Stream/allTests_A03.lib.dart +++ b/LibTest/async/Stream/allTests_A03.lib.dart @@ -7,6 +7,7 @@ /// @author a.semenov@unipro.ru library allTests_A03; + import "../../../Utils/expect.dart"; import "asBroadcastStream_A05_t03.test.dart" as asBroadcastStream_A05_t03; diff --git a/LibTest/async/Stream/any_A01_t01.test.dart b/LibTest/async/Stream/any_A01_t01.test.dart index b51ec87d63..2e7b405746 100644 --- a/LibTest/async/Stream/any_A01_t01.test.dart +++ b/LibTest/async/Stream/any_A01_t01.test.dart @@ -9,6 +9,7 @@ /// @author kaigorodov library any_A01_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { @@ -17,14 +18,10 @@ void test(CreateStreamFunction create) { AsyncExpect.value(true, create([1, 2, 3, null]).any((int? e) => e == null)); AsyncExpect.value( false, - create( - new Iterable.generate(0, (int index) => index * 2) - ).any((int element) => true) - ); + create(new Iterable.generate(0, (int index) => index * 2)) + .any((int element) => true)); AsyncExpect.value( true, - create( - new Iterable.generate(10, (int index) => index * 5) - ).any((int element) => element == 30) - ); + create(new Iterable.generate(10, (int index) => index * 5)) + .any((int element) => element == 30)); } diff --git a/LibTest/async/Stream/any_A01_t02.test.dart b/LibTest/async/Stream/any_A01_t02.test.dart index 4b6e6d1a98..f750d25ad5 100644 --- a/LibTest/async/Stream/any_A01_t02.test.dart +++ b/LibTest/async/Stream/any_A01_t02.test.dart @@ -10,6 +10,7 @@ /// @author ilya library any_A01_t02; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { @@ -17,10 +18,10 @@ void test(CreateStreamFunction create) { asyncStart(); int last = -1; create(new Iterable.generate(100, (_) => ++count)) - .any((x) => (last = x) % 10 == 0) - .then((x) { - Expect.isTrue(x); - Expect.equals(10, last); - asyncEnd(); - }); + .any((x) => (last = x) % 10 == 0) + .then((x) { + Expect.isTrue(x); + Expect.equals(10, last); + asyncEnd(); + }); } diff --git a/LibTest/async/Stream/any_A02_t01.test.dart b/LibTest/async/Stream/any_A02_t01.test.dart index 3326369ae0..fbca318ee7 100644 --- a/LibTest/async/Stream/any_A02_t01.test.dart +++ b/LibTest/async/Stream/any_A02_t01.test.dart @@ -19,12 +19,12 @@ void check(Stream stream, Object expectedError) { void test(CreateStreamWithErrorsFunction create) { Object error = new Error(); - check(create([error], - isError: (_) => true, defaultValue: new Object()), error); + check( + create([error], isError: (_) => true, defaultValue: new Object()), error); error = new Exception(); - check(create([error], - isError: (_) => true, defaultValue: new Object()), error); + check( + create([error], isError: (_) => true, defaultValue: new Object()), error); check(create([1, 2, 3], isError: (x) => x.isOdd, defaultValue: 42), 1); } diff --git a/LibTest/async/Stream/asBroadcastStream_A01_t01.test.dart b/LibTest/async/Stream/asBroadcastStream_A01_t01.test.dart index 929e4d0fb5..1a16043bfa 100644 --- a/LibTest/async/Stream/asBroadcastStream_A01_t01.test.dart +++ b/LibTest/async/Stream/asBroadcastStream_A01_t01.test.dart @@ -16,6 +16,7 @@ /// @author kaigorodov library asBroadcastStream_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; diff --git a/LibTest/async/Stream/asBroadcastStream_A01_t02.test.dart b/LibTest/async/Stream/asBroadcastStream_A01_t02.test.dart index 5a957825ae..3eba4bd274 100644 --- a/LibTest/async/Stream/asBroadcastStream_A01_t02.test.dart +++ b/LibTest/async/Stream/asBroadcastStream_A01_t02.test.dart @@ -16,6 +16,7 @@ /// @author kaigorodov library asBroadcastStream_A01_t02; + import "dart:async"; import "../../../Utils/expect.dart"; diff --git a/LibTest/async/Stream/asBroadcastStream_A01_t03.dart b/LibTest/async/Stream/asBroadcastStream_A01_t03.dart index d40564ab14..1a60655404 100644 --- a/LibTest/async/Stream/asBroadcastStream_A01_t03.dart +++ b/LibTest/async/Stream/asBroadcastStream_A01_t03.dart @@ -22,23 +22,21 @@ import "../../../Utils/expect.dart"; main() { bool hasListener = false; bool listenerCancelled = false; - StreamController controller = new StreamController( - onListen:() { hasListener = true;}, - onCancel:() { listenerCancelled = true;} - ); + StreamController controller = new StreamController(onListen: () { + hasListener = true; + }, onCancel: () { + listenerCancelled = true; + }); Stream b = controller.stream.asBroadcastStream(); Expect.isFalse(hasListener); Expect.isFalse(listenerCancelled); asyncStart(); StreamSubscription subs; - subs = b.listen( - (_) { }, - onDone: () { - Expect.isTrue(listenerCancelled); - asyncEnd(); - } - ); + subs = b.listen((_) {}, onDone: () { + Expect.isTrue(listenerCancelled); + asyncEnd(); + }); Expect.isTrue(hasListener); Expect.isFalse(listenerCancelled); controller.add("a"); diff --git a/LibTest/async/Stream/asBroadcastStream_A01_t04.test.dart b/LibTest/async/Stream/asBroadcastStream_A01_t04.test.dart index 90a4dd7398..232a2bafd3 100644 --- a/LibTest/async/Stream/asBroadcastStream_A01_t04.test.dart +++ b/LibTest/async/Stream/asBroadcastStream_A01_t04.test.dart @@ -16,6 +16,7 @@ /// @author ilya library asBroadcastStream_A01_t04; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -23,36 +24,31 @@ const int subscribersCount = 10; const int dataSize = 1000; void multiListen(Stream s) { - - for(int i = 0; i < subscribersCount; ++i) { + for (int i = 0; i < subscribersCount; ++i) { asyncStart(); if (i.isEven) { // listener that quits after half of data var quitter; - quitter = s.listen( - (int data) { - if (data > dataSize / 2) { - quitter.cancel(); - asyncEnd(); - } + quitter = s.listen((int data) { + if (data > dataSize / 2) { + quitter.cancel(); + asyncEnd(); } - ); + }); } else { // listener that works to completion int processed = 0; - s.listen( - (int data) {++processed;}, - onDone: () { - Expect.equals(dataSize, processed); - asyncEnd(); - } - ); + s.listen((int data) { + ++processed; + }, onDone: () { + Expect.equals(dataSize, processed); + asyncEnd(); + }); } } } void test(CreateStreamFunction create) { - multiListen( - create(new Iterable.generate(dataSize, (i) => i)).asBroadcastStream() - ); + multiListen(create(new Iterable.generate(dataSize, (i) => i)) + .asBroadcastStream()); } diff --git a/LibTest/async/Stream/asBroadcastStream_A01_t05.dart b/LibTest/async/Stream/asBroadcastStream_A01_t05.dart index 09220b1e0f..ce4c62eaa7 100644 --- a/LibTest/async/Stream/asBroadcastStream_A01_t05.dart +++ b/LibTest/async/Stream/asBroadcastStream_A01_t05.dart @@ -20,24 +20,20 @@ import "../../../Utils/expect.dart"; main() { bool hasListener = false; - StreamController controller = new StreamController( - onListen:(){ hasListener = true;} - ); + StreamController controller = new StreamController(onListen: () { + hasListener = true; + }); Stream b = controller.stream.asBroadcastStream(); Expect.isFalse(hasListener); asyncStart(2); - b.listen( - (_) { - Expect.isTrue(hasListener); - asyncEnd(); - } - ); - b.listen( - (_) { - Expect.isTrue(hasListener); - asyncEnd(); - } - ); + b.listen((_) { + Expect.isTrue(hasListener); + asyncEnd(); + }); + b.listen((_) { + Expect.isTrue(hasListener); + asyncEnd(); + }); Expect.isTrue(hasListener); controller.add("a"); new Future(() => controller.close()); diff --git a/LibTest/async/Stream/asBroadcastStream_A01_t06.dart b/LibTest/async/Stream/asBroadcastStream_A01_t06.dart index f39b78e088..2fbab47ed3 100644 --- a/LibTest/async/Stream/asBroadcastStream_A01_t06.dart +++ b/LibTest/async/Stream/asBroadcastStream_A01_t06.dart @@ -22,15 +22,15 @@ import "../../../Utils/expect.dart"; main() { bool hasListener = false; bool listenerCancelled = false; - StreamController controller = new StreamController( - onListen:() { hasListener = true;}, - onCancel:() { listenerCancelled = true;} - ); + StreamController controller = new StreamController(onListen: () { + hasListener = true; + }, onCancel: () { + listenerCancelled = true; + }); Stream b = controller.stream.asBroadcastStream( - onListen:(StreamSubscription subscription){ - subscription.cancel(); - } - ); + onListen: (StreamSubscription subscription) { + subscription.cancel(); + }); Expect.isFalse(hasListener); Expect.isFalse(listenerCancelled); diff --git a/LibTest/async/Stream/asBroadcastStream_A01_t07.dart b/LibTest/async/Stream/asBroadcastStream_A01_t07.dart index 9f1f389360..e785297801 100644 --- a/LibTest/async/Stream/asBroadcastStream_A01_t07.dart +++ b/LibTest/async/Stream/asBroadcastStream_A01_t07.dart @@ -22,34 +22,30 @@ import "../../../Utils/expect.dart"; main() { bool hasListener = false; bool listenerCancelled = false; - StreamController controller = new StreamController( - onListen:() { hasListener = true;}, - onCancel:() { listenerCancelled = true;} - ); + StreamController controller = new StreamController(onListen: () { + hasListener = true; + }, onCancel: () { + listenerCancelled = true; + }); Stream b = controller.stream.asBroadcastStream( - onCancel:(StreamSubscription subscription){ - subscription.cancel(); - } - ); + onCancel: (StreamSubscription subscription) { + subscription.cancel(); + }); Expect.isFalse(hasListener); Expect.isFalse(listenerCancelled); asyncStart(); var ss; - ss = b.listen( - (_) { - Future f = ss.cancel(); - if (f == null) { - f = new Future.value(0); - } - f.then( - (_) { - Expect.isTrue(listenerCancelled); - controller.close(); - asyncEnd(); - } - ); + ss = b.listen((_) { + Future f = ss.cancel(); + if (f == null) { + f = new Future.value(0); } - ); + f.then((_) { + Expect.isTrue(listenerCancelled); + controller.close(); + asyncEnd(); + }); + }); Expect.isTrue(hasListener); Expect.isFalse(listenerCancelled); diff --git a/LibTest/async/Stream/asBroadcastStream_A03_t01.test.dart b/LibTest/async/Stream/asBroadcastStream_A03_t01.test.dart index f95cc8b48f..575f63143d 100644 --- a/LibTest/async/Stream/asBroadcastStream_A03_t01.test.dart +++ b/LibTest/async/Stream/asBroadcastStream_A03_t01.test.dart @@ -19,11 +19,12 @@ /// @author ilya library asBroadcastStream_A03_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { - Stream s = create([1,2,3,4,5]); + Stream s = create([1, 2, 3, 4, 5]); asyncStart(); @@ -40,4 +41,3 @@ void test(CreateStreamFunction create) { Expect.fail('unexpected onData event'); }); } - diff --git a/LibTest/async/Stream/asBroadcastStream_A03_t02.test.dart b/LibTest/async/Stream/asBroadcastStream_A03_t02.test.dart index b86f14ca14..4e139a1a6b 100644 --- a/LibTest/async/Stream/asBroadcastStream_A03_t02.test.dart +++ b/LibTest/async/Stream/asBroadcastStream_A03_t02.test.dart @@ -19,12 +19,13 @@ /// @author a.semenov@unipro.ru library asBroadcastStream_A03_t02; + import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { - Stream s = create([1,2,3]); + Stream s = create([1, 2, 3]); s.asBroadcastStream(onListen: (StreamSubscription ss) { - Expect.throws(()=>ss.onData((_){})); - }).listen((_){}); + Expect.throws(() => ss.onData((_) {})); + }).listen((_) {}); } diff --git a/LibTest/async/Stream/asBroadcastStream_A03_t03.test.dart b/LibTest/async/Stream/asBroadcastStream_A03_t03.test.dart index ced4402299..355e95fcc2 100644 --- a/LibTest/async/Stream/asBroadcastStream_A03_t03.test.dart +++ b/LibTest/async/Stream/asBroadcastStream_A03_t03.test.dart @@ -19,12 +19,13 @@ /// @author a.semenov@unipro.ru library asBroadcastStream_A03_t03; + import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { - Stream s = create([1,2,3]); - s.asBroadcastStream(onListen: (StreamSubscription ss){ - Expect.throws(()=>ss.asFuture()); - }).listen((_){}); + Stream s = create([1, 2, 3]); + s.asBroadcastStream(onListen: (StreamSubscription ss) { + Expect.throws(() => ss.asFuture()); + }).listen((_) {}); } diff --git a/LibTest/async/Stream/asBroadcastStream_A04_t01.test.dart b/LibTest/async/Stream/asBroadcastStream_A04_t01.test.dart index 8312771fea..5623434554 100644 --- a/LibTest/async/Stream/asBroadcastStream_A04_t01.test.dart +++ b/LibTest/async/Stream/asBroadcastStream_A04_t01.test.dart @@ -16,6 +16,7 @@ /// @author ilya library asBroadcastStream_A04_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -23,11 +24,9 @@ void test(CreateStreamFunction create) { Stream s = create([1, 2, 3]); asyncStart(); - Stream b = s.asBroadcastStream( - onCancel: (StreamSubscription subs) { - asyncEnd(); - } - ); + Stream b = s.asBroadcastStream(onCancel: (StreamSubscription subs) { + asyncEnd(); + }); b.listen((_) {}); b.listen((_) {}); b.listen((_) {}); diff --git a/LibTest/async/Stream/asBroadcastStream_A04_t02.test.dart b/LibTest/async/Stream/asBroadcastStream_A04_t02.test.dart index cca915a6fb..bb5366c086 100644 --- a/LibTest/async/Stream/asBroadcastStream_A04_t02.test.dart +++ b/LibTest/async/Stream/asBroadcastStream_A04_t02.test.dart @@ -16,6 +16,7 @@ /// @author ilya library asBroadcastStream_A04_t02; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -23,26 +24,22 @@ void test(CreateStreamFunction create) { Stream s = create([1, 2, 3, 4, 5]); int cancelCount = 0; asyncStart(); - Stream b = s.asBroadcastStream( - onCancel: (subs) { - // cancel subscription to underlying stream - subs.cancel(); - Expect.equals(3, cancelCount); - asyncEnd(); - } - ); + Stream b = s.asBroadcastStream(onCancel: (subs) { + // cancel subscription to underlying stream + subs.cancel(); + Expect.equals(3, cancelCount); + asyncEnd(); + }); newSubscription(Stream stream, int count) { // get count elements and cancel var subs; - subs = stream.listen( - (_) { - if (--count==0) { - subs.cancel(); - cancelCount++; - } - } - ); + subs = stream.listen((_) { + if (--count == 0) { + subs.cancel(); + cancelCount++; + } + }); } newSubscription(b, 1); diff --git a/LibTest/async/Stream/asBroadcastStream_A04_t03.test.dart b/LibTest/async/Stream/asBroadcastStream_A04_t03.test.dart index f0f290fdda..5f1ced6111 100644 --- a/LibTest/async/Stream/asBroadcastStream_A04_t03.test.dart +++ b/LibTest/async/Stream/asBroadcastStream_A04_t03.test.dart @@ -17,6 +17,7 @@ /// @author ilya library asBroadcastStream_A04_t03; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -32,28 +33,25 @@ void test(CreateStreamFunction create) { asyncStart(); - Stream b = s.asBroadcastStream( - onListen: (StreamSubscription subs) { - if (firstListen) - firstListen = false; - else { - Expect.isTrue(subs.isPaused); - subs.resume(); - } - }, - onCancel: (StreamSubscription subs) { - if (streamOpen) { - Expect.isFalse(subs.isPaused); - subs.pause(); - anySubscribers = false; - } else { - subs.cancel(); - timer.cancel(); - Expect.listEquals([], values); - asyncEnd(); - } - } - ); + Stream b = s.asBroadcastStream(onListen: (StreamSubscription subs) { + if (firstListen) + firstListen = false; + else { + Expect.isTrue(subs.isPaused); + subs.resume(); + } + }, onCancel: (StreamSubscription subs) { + if (streamOpen) { + Expect.isFalse(subs.isPaused); + subs.pause(); + anySubscribers = false; + } else { + subs.cancel(); + timer.cancel(); + Expect.listEquals([], values); + asyncEnd(); + } + }); newSubscription(Stream stream, int n) { // get n elements and cancel @@ -62,8 +60,7 @@ void test(CreateStreamFunction create) { subs.onData((x) { // remove seen value from list values.remove(x); - if (++count == n) - subs.cancel(); + if (++count == n) subs.cancel(); }); subs.onDone(() { streamOpen = false; diff --git a/LibTest/async/Stream/asBroadcastStream_A05_t01.test.dart b/LibTest/async/Stream/asBroadcastStream_A05_t01.test.dart index 316961b8dc..fd5ddde168 100644 --- a/LibTest/async/Stream/asBroadcastStream_A05_t01.test.dart +++ b/LibTest/async/Stream/asBroadcastStream_A05_t01.test.dart @@ -11,13 +11,14 @@ /// @author a.semenov@unipro.ru library asBroadcastStream_A05_t01; + import "dart:async"; import "../../../Utils/expect.dart"; import "allTests_A01.lib.dart" as StreamTests; void test(CreateStreamFunction create) { Stream s = create([]); - if (!s.isBroadcast){ + if (!s.isBroadcast) { StreamTests.test((Iterable data) => create(data).asBroadcastStream()); } } diff --git a/LibTest/async/Stream/asBroadcastStream_A05_t02.test.dart b/LibTest/async/Stream/asBroadcastStream_A05_t02.test.dart index fc11030fda..f6c50ae530 100644 --- a/LibTest/async/Stream/asBroadcastStream_A05_t02.test.dart +++ b/LibTest/async/Stream/asBroadcastStream_A05_t02.test.dart @@ -11,19 +11,18 @@ /// @author a.semenov@unipro.ru library asBroadcastStream_A05_t02; + import "dart:async"; import "../../../Utils/expect.dart"; import "allTests_A02.lib.dart" as StreamTests; void test(CreateStreamWithErrorsFunction create) { - Stream s = create([], isError:(_) => false, defaultValue: Object()); + Stream s = create([], isError: (_) => false, defaultValue: Object()); if (!s.isBroadcast) { - StreamTests.test( - (Iterable data, { bool isError(T x)?, required T defaultValue }) { - return create(data, - isError: isError, - defaultValue: defaultValue).asBroadcastStream(); - } - ); + StreamTests.test((Iterable data, + {bool isError(T x)?, required T defaultValue}) { + return create(data, isError: isError, defaultValue: defaultValue) + .asBroadcastStream(); + }); } } diff --git a/LibTest/async/Stream/asBroadcastStream_A05_t03.test.dart b/LibTest/async/Stream/asBroadcastStream_A05_t03.test.dart index 35735dd6ae..32d4619c20 100644 --- a/LibTest/async/Stream/asBroadcastStream_A05_t03.test.dart +++ b/LibTest/async/Stream/asBroadcastStream_A05_t03.test.dart @@ -11,13 +11,14 @@ /// @author a.semenov@unipro.ru library asBroadcastStream_A05_t03; + import "dart:async"; import "../../../Utils/expect.dart"; import "allTests_A03.lib.dart" as StreamTests; void test(CreateStreamFunction create) { Stream s = create([]); - if (!s.isBroadcast){ + if (!s.isBroadcast) { StreamTests.test((Iterable data) => create(data).asBroadcastStream()); } } diff --git a/LibTest/async/Stream/asyncExpand_A01_t01.test.dart b/LibTest/async/Stream/asyncExpand_A01_t01.test.dart index 64f7bbb7fe..59aaf474b0 100644 --- a/LibTest/async/Stream/asyncExpand_A01_t01.test.dart +++ b/LibTest/async/Stream/asyncExpand_A01_t01.test.dart @@ -14,23 +14,26 @@ /// @author a.semenov@unipro.ru library asyncExpand_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; -void check(Stream stream, Stream convert(T event), List expected) { +void check( + Stream stream, Stream convert(T event), List expected) { AsyncExpect.data(expected, stream.asyncExpand(convert)); } void test(CreateStreamFunction create) { // expand to empty stream check(create([]), (_) => create([]), []); - check(create([1,2,3,4,5]), (_) => create([]), []); + check(create([1, 2, 3, 4, 5]), (_) => create([]), []); // expand to the same stream check(create([]), (e) => create([e]), []); - check(create([1,2,3,4,5]), (e) => create([e]), [1,2,3,4,5]); - check(create(['a',null,'b']), (e) => create([e]), ['a',null,'b']); + check(create([1, 2, 3, 4, 5]), (e) => create([e]), [1, 2, 3, 4, 5]); + check(create(['a', null, 'b']), (e) => create([e]), ['a', null, 'b']); // double events in the input stream - check(create([]), (e) => create([e,e]), []); - check(create([1,2,3]), (e) => create([e,e]), [1,1,2,2,3,3]); - check(create(['a',null,'b']), (e) => create([e,e]), ['a','a',null,null,'b','b']); + check(create([]), (e) => create([e, e]), []); + check(create([1, 2, 3]), (e) => create([e, e]), [1, 1, 2, 2, 3, 3]); + check(create(['a', null, 'b']), (e) => create([e, e]), + ['a', 'a', null, null, 'b', 'b']); } diff --git a/LibTest/async/Stream/asyncExpand_A02_t01.test.dart b/LibTest/async/Stream/asyncExpand_A02_t01.test.dart index 681cf47c19..7255f020f4 100644 --- a/LibTest/async/Stream/asyncExpand_A02_t01.test.dart +++ b/LibTest/async/Stream/asyncExpand_A02_t01.test.dart @@ -13,10 +13,12 @@ /// @author a.semenov@unipro.ru library asyncExpand_A02_t01; + import "dart:async"; import "../../../Utils/expect.dart"; -void check(Stream stream, Stream? convert(T event), List expected) { +void check( + Stream stream, Stream? convert(T event), List expected) { AsyncExpect.data(expected, stream.asyncExpand(convert)); } @@ -25,20 +27,12 @@ void test(CreateStreamFunction create) { check(create([1, 2, 3, 4, 5]), (_) => null, []); check(create([]), (e) => create([e]), []); - check(create([1, 2, 3, 4, 5]), (e) => e.isOdd ? create([e]) : null, [1,3,5]); - check( - create(['a', null, 'b']), - (e) => e != null ? create([e]) : null, - ['a', 'b'] - ); check( - create([1, 2, 3, 4, 5]), - (e) => e.isOdd ? create([e, e]): null, - [1, 1, 3, 3, 5, 5] - ); - check( - create(['a', null, 'b']), - (e) => e != null ? create([e, e]) : null, - ['a', 'a', 'b', 'b'] - ); + create([1, 2, 3, 4, 5]), (e) => e.isOdd ? create([e]) : null, [1, 3, 5]); + check(create(['a', null, 'b']), (e) => e != null ? create([e]) : null, + ['a', 'b']); + check(create([1, 2, 3, 4, 5]), + (e) => e.isOdd ? create([e, e]) : null, [1, 1, 3, 3, 5, 5]); + check(create(['a', null, 'b']), + (e) => e != null ? create([e, e]) : null, ['a', 'a', 'b', 'b']); } diff --git a/LibTest/async/Stream/asyncExpand_A03_t01.test.dart b/LibTest/async/Stream/asyncExpand_A03_t01.test.dart index 429ad3b852..011406c535 100644 --- a/LibTest/async/Stream/asyncExpand_A03_t01.test.dart +++ b/LibTest/async/Stream/asyncExpand_A03_t01.test.dart @@ -13,27 +13,27 @@ /// @author a.semenov@unipro.ru library asyncExpand_A03_t01; + import "dart:async"; import "../../../Utils/expect.dart"; -void check(Stream stream, Stream? convert(T event)) { +void check(Stream stream, Stream? convert(T event)) { Expect.equals(stream.isBroadcast, stream.asyncExpand(convert).isBroadcast); } void test(CreateStreamFunction create) { + check(create([]), (_) => null); + check(create([]).asBroadcastStream(), (_) => null); - check(create([]), (_) => null); - check(create([]).asBroadcastStream(), (_) => null); - - check(create([1, 2, 3, 4, 5]), (_) => null); - check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (_) => null); + check(create([1, 2, 3, 4, 5]), (_) => null); + check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (_) => null); - check(create([]), (e) => create([e])); - check(create([]).asBroadcastStream(), (e) => create([e])); + check(create([]), (e) => create([e])); + check(create([]).asBroadcastStream(), (e) => create([e])); - check(create([1, 2, 3, 4, 5]), (e) => create([e])); - check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (e) => create([e])); + check(create([1, 2, 3, 4, 5]), (e) => create([e])); + check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (e) => create([e])); - check(create([1, 2, 3, 4, 5]), (e) => create([e, e])); - check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (e) => create([e,e])); + check(create([1, 2, 3, 4, 5]), (e) => create([e, e])); + check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (e) => create([e, e])); } diff --git a/LibTest/async/Stream/asyncMap_A01_t01.test.dart b/LibTest/async/Stream/asyncMap_A01_t01.test.dart index 5eb67e2a3e..eea3b48fa9 100644 --- a/LibTest/async/Stream/asyncMap_A01_t01.test.dart +++ b/LibTest/async/Stream/asyncMap_A01_t01.test.dart @@ -14,6 +14,7 @@ /// @author a.semenov@unipro.ru library asyncMap_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -27,9 +28,5 @@ void test(CreateStreamFunction create) { check(create([1, 2, 3, 4, 5]), (e) => -e, [-1, -2, -3, -4, -5]); check(create([1, 2, 3, 4, 5]), (e) => 0, [0, 0, 0, 0, 0]); // expand to the same stream - check( - create([null, "2", -3, 4.0, []]), - (e) => e, - [null, "2", -3, 4.0, []] - ); + check(create([null, "2", -3, 4.0, []]), (e) => e, [null, "2", -3, 4.0, []]); } diff --git a/LibTest/async/Stream/asyncMap_A01_t02.test.dart b/LibTest/async/Stream/asyncMap_A01_t02.test.dart index e43977f14e..3710292e0c 100644 --- a/LibTest/async/Stream/asyncMap_A01_t02.test.dart +++ b/LibTest/async/Stream/asyncMap_A01_t02.test.dart @@ -14,6 +14,7 @@ /// @author ngl@unipro.ru library asyncMap_A01_t02; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -22,8 +23,6 @@ dynamic convert(event) => new Future.value(event); void test(CreateStreamFunction create) { AsyncExpect.data([], create([]).asyncMap(convert)); AsyncExpect.data([1, 2, 3, 4], create([1, 2, 3, 4]).asyncMap(convert)); - AsyncExpect.data( - [null, "2", -3, 4.0, []], - create([null, "2", -3, 4.0, []]).asyncMap(convert) - ); + AsyncExpect.data([null, "2", -3, 4.0, []], + create([null, "2", -3, 4.0, []]).asyncMap(convert)); } diff --git a/LibTest/async/Stream/asyncMap_A01_t03.test.dart b/LibTest/async/Stream/asyncMap_A01_t03.test.dart index a032b6371f..7ceb5dc46c 100644 --- a/LibTest/async/Stream/asyncMap_A01_t03.test.dart +++ b/LibTest/async/Stream/asyncMap_A01_t03.test.dart @@ -15,10 +15,11 @@ /// @author ngl@unipro.ru library asyncMap_A01_t03; + import "dart:async"; import "../../../Utils/expect.dart"; -void check(Stream s1, List expected) { +void check(Stream s1, List expected) { int len = expected.length; List> c = new List.generate(len, (_) => new Completer()); int i = 0; diff --git a/LibTest/async/Stream/asyncMap_A01_t04.test.dart b/LibTest/async/Stream/asyncMap_A01_t04.test.dart index 551034b1ce..913a0226f4 100644 --- a/LibTest/async/Stream/asyncMap_A01_t04.test.dart +++ b/LibTest/async/Stream/asyncMap_A01_t04.test.dart @@ -15,15 +15,15 @@ /// @author a.semenov@unipro.ru library asyncMap_A01_t04; + import "dart:async"; import "../../../Utils/expect.dart"; void check(Stream stream, List expected) { AsyncExpect.data( expected, - stream.asyncMap((e) => - new Future.delayed(durationInMilliseconds(50), () => e)) - ); + stream.asyncMap( + (e) => new Future.delayed(durationInMilliseconds(50), () => e))); } void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/asyncMap_A02_t01.test.dart b/LibTest/async/Stream/asyncMap_A02_t01.test.dart index 07f44d7b1c..6e95394917 100644 --- a/LibTest/async/Stream/asyncMap_A02_t01.test.dart +++ b/LibTest/async/Stream/asyncMap_A02_t01.test.dart @@ -10,6 +10,7 @@ /// @author a.semenov@unipro.ru library asyncMap_A02_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -18,19 +19,18 @@ void check(Stream stream, dynamic convert(T event)) { } void test(CreateStreamFunction create) { - check(create([]), (_) => null); check(create([]).asBroadcastStream(), (_) => null); - check(create([1,2,3,4,5]), (_) => null); - check(create([1,2,3,4,5]).asBroadcastStream(), (_) => null); + check(create([1, 2, 3, 4, 5]), (_) => null); + check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (_) => null); check(create([]), (e) => e); check(create([]).asBroadcastStream(), (e) => e); - check(create([1,2,3,4,5]), (e) => e); - check(create([1,2,3,4,5]).asBroadcastStream(), (e) => e); + check(create([1, 2, 3, 4, 5]), (e) => e); + check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (e) => e); - check(create([1,2,3,4,5]), (e) => e.toString()); - check(create([1,2,3,4,5]).asBroadcastStream(), (e) => e.toString()); + check(create([1, 2, 3, 4, 5]), (e) => e.toString()); + check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (e) => e.toString()); } diff --git a/LibTest/async/Stream/asyncMap_A03_t01.test.dart b/LibTest/async/Stream/asyncMap_A03_t01.test.dart index 3eb9c7c3fc..256e7c8aa0 100644 --- a/LibTest/async/Stream/asyncMap_A03_t01.test.dart +++ b/LibTest/async/Stream/asyncMap_A03_t01.test.dart @@ -19,15 +19,15 @@ /// @author a.semenov@unipro.ru library asyncMap_A03_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamWithErrorsFunction create) { - Stream stream = create( - ["a", "b", "c"], isError: (e) => true, defaultValue: ""); + Stream stream = + create(["a", "b", "c"], isError: (e) => true, defaultValue: ""); AsyncExpect.events([], ["a", "b", "c"], stream.asyncMap((e) => e)); - stream = create( - [1, 2, 3, 4, 5], isError:(e) => e.isEven, defaultValue: -1); + stream = create([1, 2, 3, 4, 5], isError: (e) => e.isEven, defaultValue: -1); AsyncExpect.events([1, 3, 5], [2, 4], stream.asyncMap((e) => e)); } diff --git a/LibTest/async/Stream/asyncMap_A03_t02.test.dart b/LibTest/async/Stream/asyncMap_A03_t02.test.dart index b60dd0c564..7b37e1bf87 100644 --- a/LibTest/async/Stream/asyncMap_A03_t02.test.dart +++ b/LibTest/async/Stream/asyncMap_A03_t02.test.dart @@ -19,6 +19,7 @@ /// @author a.semenov@unipro.ru library asyncMap_A03_t02; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -29,7 +30,7 @@ void test(CreateStreamFunction create) { Stream stream2 = create([1, 2, 3, 4, 5]); AsyncExpect.events( [1, 3, 5], // expected data - [2, 4], // expected errors + [2, 4], // expected errors stream2.asyncMap((int e) => e.isOdd ? e : throw e) // stream - ); + ); } diff --git a/LibTest/async/Stream/asyncMap_A03_t03.test.dart b/LibTest/async/Stream/asyncMap_A03_t03.test.dart index 8a7f18e220..aea596b385 100644 --- a/LibTest/async/Stream/asyncMap_A03_t03.test.dart +++ b/LibTest/async/Stream/asyncMap_A03_t03.test.dart @@ -19,21 +19,19 @@ /// @author a.semenov@unipro.ru library asyncMap_A03_t03; + import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { Stream stream1 = create(["a", "b", "c"]); - AsyncExpect.events([], - ["a", "b", "c"], stream1.asyncMap((e) => new Future.error(e))); + AsyncExpect.events( + [], ["a", "b", "c"], stream1.asyncMap((e) => new Future.error(e))); Stream stream2 = create([1, 2, 3, 4, 5]); AsyncExpect.events( - [1, 3, 5], - [2, 4], - stream2.asyncMap( - (int e) => new Future.delayed( - durationInMilliseconds(50), () => e.isOdd ? e : throw e) - ) - ); + [1, 3, 5], + [2, 4], + stream2.asyncMap((int e) => new Future.delayed( + durationInMilliseconds(50), () => e.isOdd ? e : throw e))); } diff --git a/LibTest/async/Stream/asyncMap_A04_t01.test.dart b/LibTest/async/Stream/asyncMap_A04_t01.test.dart index 51f296d3f3..0032ea3246 100644 --- a/LibTest/async/Stream/asyncMap_A04_t01.test.dart +++ b/LibTest/async/Stream/asyncMap_A04_t01.test.dart @@ -16,25 +16,23 @@ /// @author a.semenov@unipro.ru library asyncExpand_A04_t01; + import "dart:async"; import "../../../Utils/expect.dart"; Future> subscribe(Stream stream) { Completer> completer = new Completer>(); List received = []; - stream.listen( - (T event) { - received.add(event); - }, - onDone: () { - completer.complete(received); - } - ); + stream.listen((T event) { + received.add(event); + }, onDone: () { + completer.complete(received); + }); return completer.future; } Future? check(Stream stream, List expected) { - Map convertLog = new Map(); + Map convertLog = new Map(); T convert(T event) { convertLog[event] = 1 + convertLog.putIfAbsent(event, () => 0); @@ -43,17 +41,13 @@ Future? check(Stream stream, List expected) { asyncStart(); Stream converted = stream.asyncMap(convert); - Future.wait([ - subscribe(converted), - subscribe(converted), - subscribe(converted) - ]).then( - (List> result) { - result.forEach((received) => Expect.listEquals(expected, received)); - expected.forEach((event) => Expect.equals(3, convertLog[event])); - asyncEnd(); - } - ); + Future.wait( + [subscribe(converted), subscribe(converted), subscribe(converted)]) + .then((List> result) { + result.forEach((received) => Expect.listEquals(expected, received)); + expected.forEach((event) => Expect.equals(3, convertLog[event])); + asyncEnd(); + }); } void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/contains_A01_t01.test.dart b/LibTest/async/Stream/contains_A01_t01.test.dart index 0e1110df7e..d77117c12d 100644 --- a/LibTest/async/Stream/contains_A01_t01.test.dart +++ b/LibTest/async/Stream/contains_A01_t01.test.dart @@ -9,6 +9,7 @@ /// @author kaigorodov library contains_A01_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/contains_A02_t01.test.dart b/LibTest/async/Stream/contains_A02_t01.test.dart index 121843bece..4c57d6460d 100644 --- a/LibTest/async/Stream/contains_A02_t01.test.dart +++ b/LibTest/async/Stream/contains_A02_t01.test.dart @@ -9,6 +9,7 @@ /// @author a.semenov@unipro.ru library contains_A02_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -23,7 +24,7 @@ void check(Stream s, Object? match, bool expected) { Expect.equals(expected, actual); if (expected) { Expect.equals(match, seen.last); - Expect.equals(seen.length-1, seen.indexOf(match)); + Expect.equals(seen.length - 1, seen.indexOf(match)); } else { Expect.isFalse(seen.contains(match)); } diff --git a/LibTest/async/Stream/contains_A03_t01.test.dart b/LibTest/async/Stream/contains_A03_t01.test.dart index 81f58a3bad..27412a8de2 100644 --- a/LibTest/async/Stream/contains_A03_t01.test.dart +++ b/LibTest/async/Stream/contains_A03_t01.test.dart @@ -9,6 +9,7 @@ /// @author kaigorodov library contains_A03_t01; + import "dart:async"; import "../../../Utils/expect.dart"; diff --git a/LibTest/async/Stream/contains_A03_t02.test.dart b/LibTest/async/Stream/contains_A03_t02.test.dart index c192bbed67..c61683e0eb 100644 --- a/LibTest/async/Stream/contains_A03_t02.test.dart +++ b/LibTest/async/Stream/contains_A03_t02.test.dart @@ -9,12 +9,13 @@ /// @author a.semenov@unipro.ru library contains_A03_t02; + import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamWithErrorsFunction create) { Error error = new Error(); - Stream s = create( - [1, error], isError: (e) => e is Error, defaultValue: Object()); + Stream s = + create([1, error], isError: (e) => e is Error, defaultValue: Object()); AsyncExpect.value(true, s.contains(1)); } diff --git a/LibTest/async/Stream/contains_A03_t03.test.dart b/LibTest/async/Stream/contains_A03_t03.test.dart index 791ccfe004..db9611d2a8 100644 --- a/LibTest/async/Stream/contains_A03_t03.test.dart +++ b/LibTest/async/Stream/contains_A03_t03.test.dart @@ -9,12 +9,13 @@ /// @author a.semenov@unipro.ru library contains_A03_t03; + import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamWithErrorsFunction create) { Error error = new Error(); - Stream s = create( - [1, 2, error, 3, 4], isError: (e) => e is Error, defaultValue: Object()); + Stream s = create([1, 2, error, 3, 4], + isError: (e) => e is Error, defaultValue: Object()); AsyncExpect.error(error, s.contains(4)); } diff --git a/LibTest/async/Stream/distinct_A01_t01.test.dart b/LibTest/async/Stream/distinct_A01_t01.test.dart index 4aacb7aedf..7ca701c5e8 100644 --- a/LibTest/async/Stream/distinct_A01_t01.test.dart +++ b/LibTest/async/Stream/distinct_A01_t01.test.dart @@ -13,6 +13,7 @@ /// @author kaigorodov library distinct_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -21,16 +22,13 @@ void check(Stream s) { bool first = true; T? previous; asyncStart(); - d.listen( - (T event) { - Expect.isTrue(first || !(previous == event)); - first = false; - previous = event; - }, - onDone:() { - asyncEnd(); - } - ); + d.listen((T event) { + Expect.isTrue(first || !(previous == event)); + first = false; + previous = event; + }, onDone: () { + asyncEnd(); + }); } void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/distinct_A01_t02.test.dart b/LibTest/async/Stream/distinct_A01_t02.test.dart index efb1fc2c81..4b9a02b4d4 100644 --- a/LibTest/async/Stream/distinct_A01_t02.test.dart +++ b/LibTest/async/Stream/distinct_A01_t02.test.dart @@ -13,6 +13,7 @@ /// @author kaigorodov library distinct_A01_t02; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -21,37 +22,25 @@ void check(Stream s, bool equals(T previous, T next)) { bool first = true; var previous; asyncStart(); - d.listen( - (T event) { - Expect.isTrue(first || !equals(previous, event), "p=$previous, e=$event"); - first = false; - previous = event; - }, - onDone:() { - asyncEnd(); - } - ); + d.listen((T event) { + Expect.isTrue(first || !equals(previous, event), "p=$previous, e=$event"); + first = false; + previous = event; + }, onDone: () { + asyncEnd(); + }); } -int abs(x) => x < 0 ? -x: x; +int abs(x) => x < 0 ? -x : x; -int sign(x) => (x < 0) ? -1: (x == 0 ? 0 : 1); +int sign(x) => (x < 0) ? -1 : (x == 0 ? 0 : 1); void test(CreateStreamFunction create) { + check(create([1, 2, 2, 3]), (previous, next) => previous == next); check( - create([1, 2, 2, 3]), - (previous, next) => previous == next - ); - check( - create([2, 4, 3, 1]), - (previous, next) => previous % 2 == next % 2 - ); - check( - create(new Iterable.generate(10, (int index) => index)), - (var previous, var next) => abs(previous - next) <= 1 - ); - check( - create(new Iterable.generate(10, (int index) => -5 + index)), - (var previous, var next) => sign(previous) == sign(next) - ); + create([2, 4, 3, 1]), (previous, next) => previous % 2 == next % 2); + check(create(new Iterable.generate(10, (int index) => index)), + (var previous, var next) => abs(previous - next) <= 1); + check(create(new Iterable.generate(10, (int index) => -5 + index)), + (var previous, var next) => sign(previous) == sign(next)); } diff --git a/LibTest/async/Stream/distinct_A02_t01.test.dart b/LibTest/async/Stream/distinct_A02_t01.test.dart index 2123cf6e05..4f04d251b3 100644 --- a/LibTest/async/Stream/distinct_A02_t01.test.dart +++ b/LibTest/async/Stream/distinct_A02_t01.test.dart @@ -10,6 +10,7 @@ /// @author a.semenov@unipro.ru library distinct_A02_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -18,13 +19,12 @@ void check(Stream stream) { } void test(CreateStreamFunction create) { - check(create([])); check(create([]).asBroadcastStream()); - check(create([1,2,3,4,5])); - check(create([1,2,3,4,5]).asBroadcastStream()); + check(create([1, 2, 3, 4, 5])); + check(create([1, 2, 3, 4, 5]).asBroadcastStream()); - check(create(["a","b","c"])); - check(create(["a","b","c"]).asBroadcastStream()); + check(create(["a", "b", "c"])); + check(create(["a", "b", "c"]).asBroadcastStream()); } diff --git a/LibTest/async/Stream/distinct_A02_t02.test.dart b/LibTest/async/Stream/distinct_A02_t02.test.dart index 5bfaaf3f1e..af9b142e5b 100644 --- a/LibTest/async/Stream/distinct_A02_t02.test.dart +++ b/LibTest/async/Stream/distinct_A02_t02.test.dart @@ -10,6 +10,7 @@ /// @author a.semenov@unipro.ru library distinct_A02_t02; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -18,16 +19,15 @@ void check(Stream stream, bool equals(T previous, T next)) { } void test(CreateStreamFunction create) { + check(create([]), (p, n) => true); + check(create([]).asBroadcastStream(), (p, n) => true); + check(create([]), (p, n) => false); + check(create([]).asBroadcastStream(), (p, n) => false); - check(create([]), (p,n) => true); - check(create([]).asBroadcastStream(), (p,n) => true); - check(create([]), (p,n) => false); - check(create([]).asBroadcastStream(), (p,n) => false); - - check(create([1,2,3,4,5]), (p,n) => true); - check(create([1,2,3,4,5]).asBroadcastStream(), (p,n) => true); - check(create([1,2,3,4,5]), (p,n) => false); - check(create([1,2,3,4,5]).asBroadcastStream(), (p,n) => false); - check(create([1,2,3,4,5]), (p,n) => p==n); - check(create([1,2,3,4,5]).asBroadcastStream(), (p,n) => p==n); + check(create([1, 2, 3, 4, 5]), (p, n) => true); + check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (p, n) => true); + check(create([1, 2, 3, 4, 5]), (p, n) => false); + check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (p, n) => false); + check(create([1, 2, 3, 4, 5]), (p, n) => p == n); + check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (p, n) => p == n); } diff --git a/LibTest/async/Stream/distinct_A03_t01.test.dart b/LibTest/async/Stream/distinct_A03_t01.test.dart index eb0a70283b..115ce1162c 100644 --- a/LibTest/async/Stream/distinct_A03_t01.test.dart +++ b/LibTest/async/Stream/distinct_A03_t01.test.dart @@ -10,6 +10,7 @@ /// @author a.semenov@unipro.ru library distinct_A03_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -19,9 +20,10 @@ class Key { Key(this.previous, this.next); - bool operator ==(other) => (other is Key) - && other.previous == this.previous - && other.next == this.next; + bool operator ==(other) => + (other is Key) && + other.previous == this.previous && + other.next == this.next; int get hashCode { return previous.hashCode ^ next.hashCode; @@ -35,14 +37,11 @@ class Key { Future> subscribe(Stream stream) { Completer> completer = new Completer>(); List received = []; - stream.listen( - (T event) { - received.add(event); - }, - onDone: () { - completer.complete(received); - } - ); + stream.listen((T event) { + received.add(event); + }, onDone: () { + completer.complete(received); + }); return completer.future; } @@ -50,24 +49,19 @@ void check(Stream s) { Map, int> equalsLog = new Map, int>(); bool equals(T p, T n) { - Key key = new Key(p,n); + Key key = new Key(p, n); equalsLog[key] = 1 + equalsLog.putIfAbsent(key, () => 0); - return p==n; + return p == n; } asyncStart(); Stream d = s.asBroadcastStream().distinct(equals); - Future.wait([ - subscribe(d), - subscribe(d), - subscribe(d) - ]).then( - (List> result) { - result.forEach((received) => Expect.listEquals(result[0], received)); - equalsLog.values.forEach((v) => Expect.equals(3, v)); - asyncEnd(); - } - ); + Future.wait([subscribe(d), subscribe(d), subscribe(d)]) + .then((List> result) { + result.forEach((received) => Expect.listEquals(result[0], received)); + equalsLog.values.forEach((v) => Expect.equals(3, v)); + asyncEnd(); + }); } void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/distinct_A04_t01.test.dart b/LibTest/async/Stream/distinct_A04_t01.test.dart index beec7587b6..d0d48665b0 100644 --- a/LibTest/async/Stream/distinct_A04_t01.test.dart +++ b/LibTest/async/Stream/distinct_A04_t01.test.dart @@ -26,11 +26,14 @@ void test(CreateStreamWithErrorsFunction create) { [1, 3], [2, 2]); check( create([1, 1, 2, 2, 3, 3], isError: (e) => e.isEven, defaultValue: 42), - [1, 3], [2, 2]); + [1, 3], + [2, 2]); check( create([1, 1, 2, 2, 3, 3], isError: (e) => e.isOdd, defaultValue: 42), - [2], [1, 1, 3, 3]); + [2], + [1, 1, 3, 3]); check( create([1, 2, null, null], isError: (e) => e is num, defaultValue: 42), - [null], [1, 2]); + [null], + [1, 2]); } diff --git a/LibTest/async/Stream/distinct_A04_t02.test.dart b/LibTest/async/Stream/distinct_A04_t02.test.dart index dcb8404a68..bad2953fb7 100644 --- a/LibTest/async/Stream/distinct_A04_t02.test.dart +++ b/LibTest/async/Stream/distinct_A04_t02.test.dart @@ -27,11 +27,14 @@ void test(CreateStreamWithErrorsFunction create) { [1, 3], [2, 2]); check( create([1, 1, 2, 2, 3, 3], isError: (e) => e.isEven, defaultValue: 42), - [1, 3], [2, 2]); + [1, 3], + [2, 2]); check( create([1, 1, 2, 2, 3, 3], isError: (e) => e.isOdd, defaultValue: 42), - [2], [1, 1, 3, 3]); + [2], + [1, 1, 3, 3]); check( create([1, 2, null, null], isError: (e) => e is num, defaultValue: 42), - [null], [1, 2]); + [null], + [1, 2]); } diff --git a/LibTest/async/Stream/distinct_A05_t01.test.dart b/LibTest/async/Stream/distinct_A05_t01.test.dart index 7c56be76bd..45c2a416e1 100644 --- a/LibTest/async/Stream/distinct_A05_t01.test.dart +++ b/LibTest/async/Stream/distinct_A05_t01.test.dart @@ -12,14 +12,15 @@ /// @author a.semenov@unipro.ru library distinct_A05_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { AsyncExpect.events([], [], create([]).distinct((p, n) => throw "error")); - AsyncExpect.events([1], ["a","a"], create([1,2,3]).distinct((p, n) => throw "a")); AsyncExpect.events( - [1,2,4], // data - [3,5], // errors - create([1,2,3,4,5]).distinct((p, n) => n.isOdd ? throw n : p==n) - ); + [1], ["a", "a"], create([1, 2, 3]).distinct((p, n) => throw "a")); + AsyncExpect.events( + [1, 2, 4], // data + [3, 5], // errors + create([1, 2, 3, 4, 5]).distinct((p, n) => n.isOdd ? throw n : p == n)); } diff --git a/LibTest/async/Stream/drain_A01_t01.test.dart b/LibTest/async/Stream/drain_A01_t01.test.dart index f4c4e0cc4e..bcc135b4a2 100644 --- a/LibTest/async/Stream/drain_A01_t01.test.dart +++ b/LibTest/async/Stream/drain_A01_t01.test.dart @@ -18,7 +18,7 @@ import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamWithErrorsFunction create) { - Stream s = create([1, 2, 3, 4, 5], isError: (e) => true, - defaultValue: 42); + Stream s = + create([1, 2, 3, 4, 5], isError: (e) => true, defaultValue: 42); AsyncExpect.error(1, s.drain()); } diff --git a/LibTest/async/Stream/drain_A02_t01.test.dart b/LibTest/async/Stream/drain_A02_t01.test.dart index 82aae1a089..aae835f659 100644 --- a/LibTest/async/Stream/drain_A02_t01.test.dart +++ b/LibTest/async/Stream/drain_A02_t01.test.dart @@ -8,12 +8,11 @@ /// @author kaigorodov library drain_A02_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { AsyncExpect.value(-11, create([]).drain(-11)); - AsyncExpect.value( - "abc", - create(new Iterable.generate(10, (int index) => index)).drain("abc") - ); + AsyncExpect.value("abc", + create(new Iterable.generate(10, (int index) => index)).drain("abc")); } diff --git a/LibTest/async/Stream/drain_A02_t02.test.dart b/LibTest/async/Stream/drain_A02_t02.test.dart index 517f5fdb6c..fb33df39f1 100644 --- a/LibTest/async/Stream/drain_A02_t02.test.dart +++ b/LibTest/async/Stream/drain_A02_t02.test.dart @@ -9,12 +9,11 @@ /// @author kaigorodov library drain_A02_t02; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { AsyncExpect.value(null, create([]).drain()); AsyncExpect.value( - null, - create(new Iterable.generate(10, (int index) => index)).drain() - ); + null, create(new Iterable.generate(10, (int index) => index)).drain()); } diff --git a/LibTest/async/Stream/elementAt_A01_t01.test.dart b/LibTest/async/Stream/elementAt_A01_t01.test.dart index 28a62398c3..8bfb9031a8 100644 --- a/LibTest/async/Stream/elementAt_A01_t01.test.dart +++ b/LibTest/async/Stream/elementAt_A01_t01.test.dart @@ -10,14 +10,16 @@ /// @author kaigorodov library elementAt_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { AsyncExpect.value(123, create([123]).elementAt(0)); - AsyncExpect.value(123, create([1,123,2,3]).elementAt(1)); + AsyncExpect.value(123, create([1, 123, 2, 3]).elementAt(1)); for (int k = 0; k < 10; k++) { - Stream s = create(new Iterable.generate(10, (int index) => index)); + Stream s = + create(new Iterable.generate(10, (int index) => index)); AsyncExpect.value(k, s.elementAt(k)); } } diff --git a/LibTest/async/Stream/elementAt_A01_t02.test.dart b/LibTest/async/Stream/elementAt_A01_t02.test.dart index 788e49e8fe..bd09ca8db2 100644 --- a/LibTest/async/Stream/elementAt_A01_t02.test.dart +++ b/LibTest/async/Stream/elementAt_A01_t02.test.dart @@ -10,18 +10,17 @@ /// @author a.semenov@unipro.ru library elementAt_A01_t02; + import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { Stream s = create(new Iterable.generate(100, (int i) => i)); asyncStart(); - s.elementAt(5).then( - (int t) { - if (!s.isBroadcast) { - Expect.throws(() => s.listen((_) {})); - } - asyncEnd(); + s.elementAt(5).then((int t) { + if (!s.isBroadcast) { + Expect.throws(() => s.listen((_) {})); } - ); + asyncEnd(); + }); } diff --git a/LibTest/async/Stream/elementAt_A01_t03.test.dart b/LibTest/async/Stream/elementAt_A01_t03.test.dart index 150f60813f..92023ba1d1 100644 --- a/LibTest/async/Stream/elementAt_A01_t03.test.dart +++ b/LibTest/async/Stream/elementAt_A01_t03.test.dart @@ -10,6 +10,7 @@ /// @author ilya library elementAt_A01_t03; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -18,17 +19,13 @@ const int INDEX = 10; void test(CreateStreamFunction create) { int i = -1; Stream s = create(new Iterable.generate(100, (int i) => i)); - s = s.map( - (int e) { - i++; - return e; - } - ); + s = s.map((int e) { + i++; + return e; + }); asyncStart(); - s.elementAt(INDEX).then( - (int t) { - Expect.equals(INDEX, i); - asyncEnd(); - } - ); + s.elementAt(INDEX).then((int t) { + Expect.equals(INDEX, i); + asyncEnd(); + }); } diff --git a/LibTest/async/Stream/elementAt_A03_t01.test.dart b/LibTest/async/Stream/elementAt_A03_t01.test.dart index bdb7892f12..5d5a2cf812 100644 --- a/LibTest/async/Stream/elementAt_A03_t01.test.dart +++ b/LibTest/async/Stream/elementAt_A03_t01.test.dart @@ -10,6 +10,7 @@ /// @author kaigorodov library elementAt_A03_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/every_A01_t01.test.dart b/LibTest/async/Stream/every_A01_t01.test.dart index 1175d74e88..32ff4f6a6b 100644 --- a/LibTest/async/Stream/every_A01_t01.test.dart +++ b/LibTest/async/Stream/every_A01_t01.test.dart @@ -9,12 +9,14 @@ /// @author kaigorodov library every_A01_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { AsyncExpect.value(true, create([]).every((var element) => true)); AsyncExpect.value(true, create([1, 2, 3]).every((int? e) => e != null)); - AsyncExpect.value(false, create([1, 2, 3, null]).every((int? e) => e == null)); + AsyncExpect.value( + false, create([1, 2, 3, null]).every((int? e) => e == null)); AsyncExpect.value(true, create(new Iterable.generate(0, (int i) => i)).every((int e) => false)); AsyncExpect.value(false, @@ -23,10 +25,16 @@ void test(CreateStreamFunction create) { create(new Iterable.generate(0, (int i) => i)).every((int e) => true)); AsyncExpect.value(true, create(new Iterable.generate(2, (int i) => i)).every((int e) => true)); - AsyncExpect.value(false, - create(new Iterable.generate(10, (int i) => i * 5)).every((int e) => e == 30)); - AsyncExpect.value(false, - create(new Iterable.generate(10, (int i) => i * 5)).every((int e) => e != 30)); - AsyncExpect.value(true, - create(new Iterable.generate(10, (int i) => i * 5)).every((int e) => e >= 0)); + AsyncExpect.value( + false, + create(new Iterable.generate(10, (int i) => i * 5)) + .every((int e) => e == 30)); + AsyncExpect.value( + false, + create(new Iterable.generate(10, (int i) => i * 5)) + .every((int e) => e != 30)); + AsyncExpect.value( + true, + create(new Iterable.generate(10, (int i) => i * 5)) + .every((int e) => e >= 0)); } diff --git a/LibTest/async/Stream/every_A02_t01.test.dart b/LibTest/async/Stream/every_A02_t01.test.dart index 74da912250..b79b8e5200 100644 --- a/LibTest/async/Stream/every_A02_t01.test.dart +++ b/LibTest/async/Stream/every_A02_t01.test.dart @@ -20,10 +20,14 @@ void check(Stream s, Object expectedError) { void test(CreateStreamWithErrorsFunction create) { Object error = new ArgumentError(1); check(create([error], isError: (e) => true, defaultValue: Object()), error); - check(create([1, 2, error, 3, 4], isError: (e) => e is ArgumentError, - defaultValue: Object()), error); + check( + create([1, 2, error, 3, 4], + isError: (e) => e is ArgumentError, defaultValue: Object()), + error); error = new StateError(""); check(create([error], isError: (e) => true, defaultValue: Object()), error); - check(create([1, 2, error, 3, 4], isError: (e) => e is StateError, - defaultValue: Object()), error); + check( + create([1, 2, error, 3, 4], + isError: (e) => e is StateError, defaultValue: Object()), + error); } diff --git a/LibTest/async/Stream/every_A03_t01.test.dart b/LibTest/async/Stream/every_A03_t01.test.dart index a5aa5a4ea2..8ccc23616f 100644 --- a/LibTest/async/Stream/every_A03_t01.test.dart +++ b/LibTest/async/Stream/every_A03_t01.test.dart @@ -10,11 +10,12 @@ /// @author a.semenov@unipro.ru library every_A03_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { Object expectedError = new ArgumentError(1); - Stream s = create([1,2,3]); + Stream s = create([1, 2, 3]); AsyncExpect.error(expectedError, s.every((element) => throw expectedError)); } diff --git a/LibTest/async/Stream/expand_A01_t01.test.dart b/LibTest/async/Stream/expand_A01_t01.test.dart index 06daf55cf6..49027f1bf8 100644 --- a/LibTest/async/Stream/expand_A01_t01.test.dart +++ b/LibTest/async/Stream/expand_A01_t01.test.dart @@ -12,10 +12,11 @@ /// @author a.semenov@unipro.ru library expand_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; -void check(Stream s, Iterable convert(T value), List expected) { +void check(Stream s, Iterable convert(T value), List expected) { AsyncExpect.data(expected, s.expand(convert)); } @@ -29,6 +30,11 @@ void test(CreateStreamFunction create) { check(create([1, 2, 3]), (v) => [v, v], [1, 1, 2, 2, 3, 3]); check(create([1, 2, 3]), (v) => [null, v], [null, 1, null, 2, null, 3]); - check, int>(create([[1, 2, 3], [4, 5]]), (value) => value, - [1, 2, 3, 4, 5]); + check, int>( + create([ + [1, 2, 3], + [4, 5] + ]), + (value) => value, + [1, 2, 3, 4, 5]); } diff --git a/LibTest/async/Stream/expand_A02_t01.test.dart b/LibTest/async/Stream/expand_A02_t01.test.dart index 87e5d03c20..d38795e2a1 100644 --- a/LibTest/async/Stream/expand_A02_t01.test.dart +++ b/LibTest/async/Stream/expand_A02_t01.test.dart @@ -10,27 +10,27 @@ /// @author a.semenov@unipro.ru library expand_A02_t01; + import "dart:async"; import "../../../Utils/expect.dart"; -void check(Stream stream, Iterable convert(T event)) { +void check(Stream stream, Iterable convert(T event)) { Expect.equals(stream.isBroadcast, stream.expand(convert).isBroadcast); } void test(CreateStreamFunction create) { - check(create([]), (_) => []); check(create([]).asBroadcastStream(), (_) => []); - check(create([1,2,3,4,5]), (_) => []); - check(create([1,2,3,4,5]).asBroadcastStream(), (_) => []); + check(create([1, 2, 3, 4, 5]), (_) => []); + check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (_) => []); check(create([]), (e) => [e]); check(create([]).asBroadcastStream(), (e) => [e]); - check(create([1,2,3,4,5]), (e) => [e]); - check(create([1,2,3,4,5]).asBroadcastStream(), (e) => [e]); + check(create([1, 2, 3, 4, 5]), (e) => [e]); + check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (e) => [e]); - check(create([1,2,3,4,5]), (e) => [e,e]); - check(create([1,2,3,4,5]).asBroadcastStream(), (e) => [e,e]); + check(create([1, 2, 3, 4, 5]), (e) => [e, e]); + check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (e) => [e, e]); } diff --git a/LibTest/async/Stream/expand_A03_t01.test.dart b/LibTest/async/Stream/expand_A03_t01.test.dart index 6f559641a0..031830b3b7 100644 --- a/LibTest/async/Stream/expand_A03_t01.test.dart +++ b/LibTest/async/Stream/expand_A03_t01.test.dart @@ -9,35 +9,29 @@ /// @author a.semenov@unipro.ru library expand_A03_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void check(Stream s, List expected) { - Map convertLog = new Map(); + Map convertLog = new Map(); asyncStart(); - Stream stream = s.asBroadcastStream().expand( - (T event) { - convertLog[event] = 1 + convertLog.putIfAbsent(event, () => 0); - return [event]; - } - ); - Future.wait([ - stream.toList(), - stream.toList(), - stream.toList() - ]).then( - (List> results) { - Expect.equals(3, results.length); - results.forEach((actual) => Expect.listEquals(expected,actual)); - Expect.equals(expected.length, convertLog.length); - expected.forEach((e) => Expect.equals(3, convertLog[e])); - asyncEnd(); - } - ); + Stream stream = s.asBroadcastStream().expand((T event) { + convertLog[event] = 1 + convertLog.putIfAbsent(event, () => 0); + return [event]; + }); + Future.wait([stream.toList(), stream.toList(), stream.toList()]) + .then((List> results) { + Expect.equals(3, results.length); + results.forEach((actual) => Expect.listEquals(expected, actual)); + Expect.equals(expected.length, convertLog.length); + expected.forEach((e) => Expect.equals(3, convertLog[e])); + asyncEnd(); + }); } void test(CreateStreamFunction create) { - check(create([]), []); - check(create([1,2,3,4,5]), [1,2,3,4,5]); - check(create(["a","b","c"]), ["a","b","c"]); + check(create([]), []); + check(create([1, 2, 3, 4, 5]), [1, 2, 3, 4, 5]); + check(create(["a", "b", "c"]), ["a", "b", "c"]); } diff --git a/LibTest/async/Stream/firstWhere_A01_t01.test.dart b/LibTest/async/Stream/firstWhere_A01_t01.test.dart index f6b066b259..51918f4e84 100644 --- a/LibTest/async/Stream/firstWhere_A01_t01.test.dart +++ b/LibTest/async/Stream/firstWhere_A01_t01.test.dart @@ -33,6 +33,7 @@ /// @author kaigorodov library firstWhere_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; diff --git a/LibTest/async/Stream/firstWhere_A02_t01.test.dart b/LibTest/async/Stream/firstWhere_A02_t01.test.dart index 44a701de98..142e5a3d7b 100644 --- a/LibTest/async/Stream/firstWhere_A02_t01.test.dart +++ b/LibTest/async/Stream/firstWhere_A02_t01.test.dart @@ -34,6 +34,7 @@ /// @author kaigorodov library firstWhere_A02_t01; + import "dart:async"; import "../../../Utils/expect.dart"; diff --git a/LibTest/async/Stream/firstWhere_A03_t02.test.dart b/LibTest/async/Stream/firstWhere_A03_t02.test.dart index 3dfb62b655..36146acb5f 100644 --- a/LibTest/async/Stream/firstWhere_A03_t02.test.dart +++ b/LibTest/async/Stream/firstWhere_A03_t02.test.dart @@ -33,6 +33,7 @@ /// @author kaigorodov library firstWhere_A03_t02; + import "dart:async"; import "../../../Utils/expect.dart"; diff --git a/LibTest/async/Stream/firstWhere_A03_t03.test.dart b/LibTest/async/Stream/firstWhere_A03_t03.test.dart index 9842be71ed..1595766a8e 100644 --- a/LibTest/async/Stream/firstWhere_A03_t03.test.dart +++ b/LibTest/async/Stream/firstWhere_A03_t03.test.dart @@ -33,11 +33,12 @@ /// @author kaigorodov library firstWhere_A03_t03; + import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { Error expected = new Error(); - Stream s = create([1,2,3,4,5]); + Stream s = create([1, 2, 3, 4, 5]); AsyncExpect.error(expected, s.firstWhere((v) => throw expected)); } diff --git a/LibTest/async/Stream/firstWhere_A03_t04.test.dart b/LibTest/async/Stream/firstWhere_A03_t04.test.dart index 48f852d578..1194092789 100644 --- a/LibTest/async/Stream/firstWhere_A03_t04.test.dart +++ b/LibTest/async/Stream/firstWhere_A03_t04.test.dart @@ -33,12 +33,13 @@ /// @author a.semenov@unipro.ru library firstWhere_A03_t04; + import "dart:async"; import "../../../Utils/expect.dart"; void check(Stream s, bool test(int? element)) { Error expected = new TypeError(); - AsyncExpect.error(expected, s.firstWhere(test, orElse:() => throw expected)); + AsyncExpect.error(expected, s.firstWhere(test, orElse: () => throw expected)); } void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/firstWhere_A04_t01.test.dart b/LibTest/async/Stream/firstWhere_A04_t01.test.dart index d842c1f752..ac135256f7 100644 --- a/LibTest/async/Stream/firstWhere_A04_t01.test.dart +++ b/LibTest/async/Stream/firstWhere_A04_t01.test.dart @@ -33,22 +33,21 @@ /// @author a.semenov@unipro.ru library firstWhere_A04_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void check(Stream s) { asyncStart(); - s.firstWhere((_) => true).then( - (_) { - if (!s.isBroadcast){ - Expect.throws(() => s.listen((_){})); - } - asyncEnd(); + s.firstWhere((_) => true).then((_) { + if (!s.isBroadcast) { + Expect.throws(() => s.listen((_) {})); } - ); + asyncEnd(); + }); } void test(CreateStreamFunction create) { check(create([123])); - check(create([1,2,3])); + check(create([1, 2, 3])); } diff --git a/LibTest/async/Stream/first_A01_t01.test.dart b/LibTest/async/Stream/first_A01_t01.test.dart index 52bf089493..7c6a7c6c95 100644 --- a/LibTest/async/Stream/first_A01_t01.test.dart +++ b/LibTest/async/Stream/first_A01_t01.test.dart @@ -8,9 +8,10 @@ /// @author kaigorodov library first_A01_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { AsyncExpect.value(123, create([123]).first); - AsyncExpect.value(1, create([1,2,3]).first); + AsyncExpect.value(1, create([1, 2, 3]).first); } diff --git a/LibTest/async/Stream/first_A02_t01.test.dart b/LibTest/async/Stream/first_A02_t01.test.dart index c51ec2d06a..e3db609dbd 100644 --- a/LibTest/async/Stream/first_A02_t01.test.dart +++ b/LibTest/async/Stream/first_A02_t01.test.dart @@ -12,6 +12,7 @@ /// @author kaigorodov library first_A02_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/first_A02_t02.test.dart b/LibTest/async/Stream/first_A02_t02.test.dart index d16b37057b..5780147f47 100644 --- a/LibTest/async/Stream/first_A02_t02.test.dart +++ b/LibTest/async/Stream/first_A02_t02.test.dart @@ -12,20 +12,17 @@ /// @author kaigorodov library first_A02_t02; + import "dart:async"; import "../../../Utils/expect.dart"; void check(Stream s) { asyncStart(); s = s.asBroadcastStream(); - Future.wait( - [s.elementAt(0), s.first] - ).then( - (List result) { - Expect.equals(result[0], result[1]); - asyncEnd(); - } - ); + Future.wait([s.elementAt(0), s.first]).then((List result) { + Expect.equals(result[0], result[1]); + asyncEnd(); + }); } void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/first_A04_t01.test.dart b/LibTest/async/Stream/first_A04_t01.test.dart index 14394c95ef..c4073a736f 100644 --- a/LibTest/async/Stream/first_A04_t01.test.dart +++ b/LibTest/async/Stream/first_A04_t01.test.dart @@ -12,22 +12,21 @@ /// @author a.semenov@unipro.ru library first_A04_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void check(Stream s) { asyncStart(); - s.first.then( - (_) { - if (!s.isBroadcast){ - Expect.throws(() => s.listen((_){})); - } - asyncEnd(); + s.first.then((_) { + if (!s.isBroadcast) { + Expect.throws(() => s.listen((_) {})); } - ); + asyncEnd(); + }); } void test(CreateStreamFunction create) { check(create([123])); - check(create([1,2,3])); + check(create([1, 2, 3])); } diff --git a/LibTest/async/Stream/fold_A01_t01.test.dart b/LibTest/async/Stream/fold_A01_t01.test.dart index 844f69f71d..3390471234 100644 --- a/LibTest/async/Stream/fold_A01_t01.test.dart +++ b/LibTest/async/Stream/fold_A01_t01.test.dart @@ -8,11 +8,12 @@ /// @author kaigorodov library fold_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; -void check(Stream s, S initialValue, S combine(S previous, T element), - S expected) { +void check( + Stream s, S initialValue, S combine(S previous, T element), S expected) { AsyncExpect.value(expected, s.fold(initialValue, combine)); } diff --git a/LibTest/async/Stream/fold_A01_t02.test.dart b/LibTest/async/Stream/fold_A01_t02.test.dart index 0af225ef96..8e5def9941 100644 --- a/LibTest/async/Stream/fold_A01_t02.test.dart +++ b/LibTest/async/Stream/fold_A01_t02.test.dart @@ -10,6 +10,7 @@ /// @author kaigorodov library fold_A01_t02; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/forEach_A01_t01.test.dart b/LibTest/async/Stream/forEach_A01_t01.test.dart index e7ed3073e4..8e2c1f1c85 100644 --- a/LibTest/async/Stream/forEach_A01_t01.test.dart +++ b/LibTest/async/Stream/forEach_A01_t01.test.dart @@ -11,18 +11,17 @@ /// @author kaigorodov library forEach_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void check(Stream s, List data) { List sink = []; asyncStart(); - s.forEach((T element) => sink.add(element)).then( - (_) { - Expect.listEquals(data, sink); - asyncEnd(); - } - ); + s.forEach((T element) => sink.add(element)).then((_) { + Expect.listEquals(data, sink); + asyncEnd(); + }); } void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/forEach_A02_t01.test.dart b/LibTest/async/Stream/forEach_A02_t01.test.dart index e04f40090d..8a88e18d37 100644 --- a/LibTest/async/Stream/forEach_A02_t01.test.dart +++ b/LibTest/async/Stream/forEach_A02_t01.test.dart @@ -22,11 +22,11 @@ void test(CreateStreamWithErrorsFunction create) { check(create([1, 2, 3, 4], isError: (v) => v == 4, defaultValue: 42), 4); List list = []; check( - create([null, "2", -3, 4.0, list], isError: (v) => v == list, - defaultValue: 42), + create([null, "2", -3, 4.0, list], + isError: (v) => v == list, defaultValue: 42), list); check( - create([null, "2", -3, 4.0, list], isError: (v) => v == 4.0, - defaultValue: 42), + create([null, "2", -3, 4.0, list], + isError: (v) => v == 4.0, defaultValue: 42), 4.0); } diff --git a/LibTest/async/Stream/forEach_A02_t02.test.dart b/LibTest/async/Stream/forEach_A02_t02.test.dart index b4d9dc06fd..ca18ba68d9 100644 --- a/LibTest/async/Stream/forEach_A02_t02.test.dart +++ b/LibTest/async/Stream/forEach_A02_t02.test.dart @@ -9,26 +9,22 @@ /// @author kaigorodov library forEach_A02_t02; + import "dart:async"; import "../../../Utils/expect.dart"; void check(Stream s, Object errorElement) { Error expectedError = new Error(); - AsyncExpect.error( - expectedError, - s.forEach( - (element) { - if (element == errorElement) { - throw expectedError; - } - } - ) - ); + AsyncExpect.error(expectedError, s.forEach((element) { + if (element == errorElement) { + throw expectedError; + } + })); } void test(CreateStreamFunction create) { check(create([1, 2, 3, 4]), 4); - Map m={}; + Map m = {}; check(create([null, "2", -3, 4.0, m]), m); check(create([null, "2", -3, 4.0, m]), 4.0); } diff --git a/LibTest/async/Stream/handleError_A01_t01.test.dart b/LibTest/async/Stream/handleError_A01_t01.test.dart index 53aa23cef9..0e6edabf20 100644 --- a/LibTest/async/Stream/handleError_A01_t01.test.dart +++ b/LibTest/async/Stream/handleError_A01_t01.test.dart @@ -38,8 +38,8 @@ void check( void test(CreateStreamWithErrorsFunction create) { check(create([], defaultValue: 42), (x) => true, [], [], []); - check(create([], isError: (x) => true, defaultValue: 42), - (x) => true, [], [], []); + check(create([], isError: (x) => true, defaultValue: 42), (x) => true, [], [], + []); check(create([1, 2, 3, 4, 5], isError: (x) => true, defaultValue: 42), (x) => x.isEven, [], [2, 4], [1, 3, 5]); diff --git a/LibTest/async/Stream/handleError_A02_t01.test.dart b/LibTest/async/Stream/handleError_A02_t01.test.dart index fa8c0e4998..f9ea58ae6b 100644 --- a/LibTest/async/Stream/handleError_A02_t01.test.dart +++ b/LibTest/async/Stream/handleError_A02_t01.test.dart @@ -34,10 +34,13 @@ void test(CreateStreamWithErrorsFunction create) { check(create([], isError: (x) => true, defaultValue: 42), [], []); check(create([1, 2, 3, 4], defaultValue: 42), [1, 2, 3, 4], []); - check(create([1, 2, 3, 4], isError: (x) => true, defaultValue: 42), - [], [1, 2, 3, 4]); + check(create([1, 2, 3, 4], isError: (x) => true, defaultValue: 42), [], + [1, 2, 3, 4]); check(create([1, 2, 3, 4], isError: (x) => x.isEven, defaultValue: 42), [1, 3], [2, 4]); - check(create([null, "2", -3, 4.0, []], isError: (x) => x is num, - defaultValue: 42), [null, "2", []], [-3, 4.0]); + check( + create([null, "2", -3, 4.0, []], + isError: (x) => x is num, defaultValue: 42), + [null, "2", []], + [-3, 4.0]); } diff --git a/LibTest/async/Stream/handleError_A03_t01.test.dart b/LibTest/async/Stream/handleError_A03_t01.test.dart index d60fcbc954..9221310de5 100644 --- a/LibTest/async/Stream/handleError_A03_t01.test.dart +++ b/LibTest/async/Stream/handleError_A03_t01.test.dart @@ -11,6 +11,7 @@ /// @author a.semenov@unipro.ru library handleError_A03_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -20,48 +21,50 @@ void check( List actualErrors = []; List actualData = []; asyncStart(); - s.handleError( - (error) { - actualIntercepted.add(error); - onError(error); - } - ).listen( - (data) { - actualData.add(data); - }, - onError: (error){ - actualErrors.add(error); - }, - onDone:() { - Expect.listEquals(data, actualData); - Expect.listEquals(intercepted, actualIntercepted); - Expect.listEquals(expected, actualErrors); - asyncEnd(); - } - ); + s.handleError((error) { + actualIntercepted.add(error); + onError(error); + }).listen((data) { + actualData.add(data); + }, onError: (error) { + actualErrors.add(error); + }, onDone: () { + Expect.listEquals(data, actualData); + Expect.listEquals(intercepted, actualIntercepted); + Expect.listEquals(expected, actualErrors); + asyncEnd(); + }); } void test(CreateStreamWithErrorsFunction create) { check(create([], defaultValue: 42), (e) => throw e, [], [], []); - check(create([], isError:(x) => true, defaultValue: 42), - (e) => throw e, [], [], []); + check(create([], isError: (x) => true, defaultValue: 42), (e) => throw e, [], + [], []); check(create([1, 2, 3, 4, 5], isError: (x) => true, defaultValue: 42), (x) => throw x, [], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5]); - check(create(["a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f"], - isError: (x) => x is num, defaultValue: 42), - (x) { if (x.isEven) { throw x; }}, // onError function + check( + create(["a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f"], + isError: (x) => x is num, defaultValue: 42), (x) { + if (x.isEven) { + throw x; + } + }, // onError function ["a", "b", "c", "d", "e", "f"], // expected data - [1, 2, 3, 4, 5], // intercepted errors - [2,4] // rethrown errors - ); + [1, 2, 3, 4, 5], // intercepted errors + [2, 4] // rethrown errors + ); - check(create(["a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f"], - isError: (x) => x is num, defaultValue: 42), - (x) { if (x.isEven) { throw x + 10; }}, // onError function + check( + create(["a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f"], + isError: (x) => x is num, defaultValue: 42), (x) { + if (x.isEven) { + throw x + 10; + } + }, // onError function ["a", "b", "c", "d", "e", "f"], // expected data - [1, 2, 3, 4, 5], // intercepted errors - [12,14] // rethrown errors - ); + [1, 2, 3, 4, 5], // intercepted errors + [12, 14] // rethrown errors + ); } diff --git a/LibTest/async/Stream/handleError_A04_t01.dart b/LibTest/async/Stream/handleError_A04_t01.dart index d5540eaff7..c7bd9594b5 100644 --- a/LibTest/async/Stream/handleError_A04_t01.dart +++ b/LibTest/async/Stream/handleError_A04_t01.dart @@ -25,7 +25,7 @@ main() { Stream s2 = s.map((event) { try { throw new Error(); - } catch(e, st) { + } catch (e, st) { errors.add(e); stackTraces.add(st); rethrow; // error and stack trace are the same as e and st @@ -42,7 +42,7 @@ main() { s3.listen((_) { Expect.fail('unexpected onData event'); - }, onError:(_) { + }, onError: (_) { Expect.fail('unexpected onError event'); }); } diff --git a/LibTest/async/Stream/handleError_A04_t02.dart b/LibTest/async/Stream/handleError_A04_t02.dart index 67c16c1648..e91ee7f37f 100644 --- a/LibTest/async/Stream/handleError_A04_t02.dart +++ b/LibTest/async/Stream/handleError_A04_t02.dart @@ -21,7 +21,7 @@ main() { var s; try { throw error; - } catch (e,st) { + } catch (e, st) { stackTrace = st; s = new Stream.fromFuture(new Future.error(e, st)); } diff --git a/LibTest/async/Stream/handleError_A06_t01.test.dart b/LibTest/async/Stream/handleError_A06_t01.test.dart index cb99ca8c00..aa131a9620 100644 --- a/LibTest/async/Stream/handleError_A06_t01.test.dart +++ b/LibTest/async/Stream/handleError_A06_t01.test.dart @@ -9,16 +9,18 @@ /// @author a.semenov@unipro.ru library handleError_A06_t01; + import "dart:async"; import "../../../Utils/expect.dart"; -void check(Stream stream, Function? onError(dynamic event), bool test(error)) { +void check( + Stream stream, Function? onError(dynamic event), bool test(error)) { Expect.equals(stream.isBroadcast, stream.handleError(onError).isBroadcast); - Expect.equals(stream.isBroadcast, stream.handleError(onError, test:test).isBroadcast); + Expect.equals( + stream.isBroadcast, stream.handleError(onError, test: test).isBroadcast); } void test(CreateStreamFunction create) { - check(create([]), (_) => null, (_) => true); check(create([]).asBroadcastStream(), (_) => null, (_) => true); @@ -29,5 +31,6 @@ void test(CreateStreamFunction create) { check(create([]).asBroadcastStream(), (e) => throw e, (_) => true); check(create([1, 2, 3, 4, 5]), (e) => throw e, (_) => true); - check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (e) => throw e, (_) => true); + check( + create([1, 2, 3, 4, 5]).asBroadcastStream(), (e) => throw e, (_) => true); } diff --git a/LibTest/async/Stream/handleError_A07_t01.test.dart b/LibTest/async/Stream/handleError_A07_t01.test.dart index 27f110abf3..804e233123 100644 --- a/LibTest/async/Stream/handleError_A07_t01.test.dart +++ b/LibTest/async/Stream/handleError_A07_t01.test.dart @@ -15,8 +15,8 @@ import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamWithErrorsFunction create) { - Stream s = create(["a", 1, "b", 2, "c", 3], isError: (x) => x is num, - defaultValue: 42); + Stream s = create(["a", 1, "b", 2, "c", 3], + isError: (x) => x is num, defaultValue: 42); Map onErrorCalls = new Map(); Map testCalls = new Map(); asyncStart(); diff --git a/LibTest/async/Stream/isBroadcast_A01_t01.dart b/LibTest/async/Stream/isBroadcast_A01_t01.dart index 1f0a591ecd..a07dc44ed9 100644 --- a/LibTest/async/Stream/isBroadcast_A01_t01.dart +++ b/LibTest/async/Stream/isBroadcast_A01_t01.dart @@ -9,38 +9,35 @@ import "dart:async"; import "../../../Utils/expect.dart"; + class MyStreamSubscription implements StreamSubscription { @override Future asFuture([E? futureValue]) { throw UnimplementedError(); } + @override Future cancel() { throw UnimplementedError(); } + @override - void onData(void Function(T data)? handleData) { - } + void onData(void Function(T data)? handleData) {} @override - void onDone(void Function()? handleDone) { - } + void onDone(void Function()? handleDone) {} @override - void onError(Function? handleError) { - } + void onError(Function? handleError) {} @override - void pause([Future? resumeSignal]) { - } + void pause([Future? resumeSignal]) {} @override - void resume() { - } + void resume() {} @override bool get isPaused => throw UnimplementedError(); } class MyStream extends Stream { StreamSubscription listen(void onData(T event)?, - {Function? onError, void onDone()?, bool? cancelOnError}) - { + {Function? onError, void onDone()?, bool? cancelOnError}) { return new MyStreamSubscription(); } } diff --git a/LibTest/async/Stream/isEmpty_A01_t01.test.dart b/LibTest/async/Stream/isEmpty_A01_t01.test.dart index c373124649..1b20c777f9 100644 --- a/LibTest/async/Stream/isEmpty_A01_t01.test.dart +++ b/LibTest/async/Stream/isEmpty_A01_t01.test.dart @@ -13,11 +13,14 @@ /// @author kaigorodov library isEmpty_A01_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { AsyncExpect.value(true, create([]).isEmpty); AsyncExpect.value(false, create([1, 2, 3, null]).isEmpty); - AsyncExpect.value(true, create(new Iterable.generate(0, (int index) => 1)).isEmpty); - AsyncExpect.value(false, create(new Iterable.generate(10, (int index) => 1)).isEmpty); + AsyncExpect.value( + true, create(new Iterable.generate(0, (int index) => 1)).isEmpty); + AsyncExpect.value( + false, create(new Iterable.generate(10, (int index) => 1)).isEmpty); } diff --git a/LibTest/async/Stream/isEmpty_A02_t01.test.dart b/LibTest/async/Stream/isEmpty_A02_t01.test.dart index 13ee8c54e1..e95bbcfe81 100644 --- a/LibTest/async/Stream/isEmpty_A02_t01.test.dart +++ b/LibTest/async/Stream/isEmpty_A02_t01.test.dart @@ -12,25 +12,22 @@ /// @author a.semenov@unipro.ru library isEmpty_A02_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void check(Stream s, bool expected) { int count = 0; asyncStart(); - s = s.map( - (e) { - count++; - return e; - } - ); - s.isEmpty.then( - (bool actual) { - Expect.equals(expected ? 0 : 1, count); - Expect.equals(expected, actual); - asyncEnd(); - } - ); + s = s.map((e) { + count++; + return e; + }); + s.isEmpty.then((bool actual) { + Expect.equals(expected ? 0 : 1, count); + Expect.equals(expected, actual); + asyncEnd(); + }); } test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/isEmpty_A03_t01.test.dart b/LibTest/async/Stream/isEmpty_A03_t01.test.dart index 6886069426..77f425e230 100644 --- a/LibTest/async/Stream/isEmpty_A03_t01.test.dart +++ b/LibTest/async/Stream/isEmpty_A03_t01.test.dart @@ -11,12 +11,17 @@ /// @author a.semenov@unipro.ru library isEmpty_A03_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamWithErrorsFunction create) { AsyncExpect.value(true, create([], defaultValue: 42).isEmpty); - AsyncExpect.error(1, - create([1, 2, 3, null], isError:(x) => x==1, defaultValue: 42).isEmpty); - AsyncExpect.value(false, - create([1, 2, 3, null], isError:(x) => x==3, defaultValue: 42).isEmpty); + AsyncExpect.error( + 1, + create([1, 2, 3, null], isError: (x) => x == 1, defaultValue: 42) + .isEmpty); + AsyncExpect.value( + false, + create([1, 2, 3, null], isError: (x) => x == 3, defaultValue: 42) + .isEmpty); } diff --git a/LibTest/async/Stream/isEmpty_A04_t01.test.dart b/LibTest/async/Stream/isEmpty_A04_t01.test.dart index 8134c0cc3f..512e7b594f 100644 --- a/LibTest/async/Stream/isEmpty_A04_t01.test.dart +++ b/LibTest/async/Stream/isEmpty_A04_t01.test.dart @@ -10,20 +10,19 @@ /// @author a.semenov@unipro.ru library isEmpty_A04_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void check(Stream s, bool expected) { asyncStart(); - s.isEmpty.then( - (bool actual) { - Expect.equals(expected, actual); - if (!s.isBroadcast) { - Expect.throws(() => s.listen((_) {})); - } - asyncEnd(); + s.isEmpty.then((bool actual) { + Expect.equals(expected, actual); + if (!s.isBroadcast) { + Expect.throws(() => s.listen((_) {})); } - ); + asyncEnd(); + }); } void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/join_A01_t01.test.dart b/LibTest/async/Stream/join_A01_t01.test.dart index f7485c35f7..040c286b24 100644 --- a/LibTest/async/Stream/join_A01_t01.test.dart +++ b/LibTest/async/Stream/join_A01_t01.test.dart @@ -9,6 +9,7 @@ /// @author ilya library join_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; diff --git a/LibTest/async/Stream/join_A01_t02.test.dart b/LibTest/async/Stream/join_A01_t02.test.dart index edcf3884d5..2733f5c7e8 100644 --- a/LibTest/async/Stream/join_A01_t02.test.dart +++ b/LibTest/async/Stream/join_A01_t02.test.dart @@ -10,6 +10,7 @@ /// @author ilya library join_A01_t02; + import "dart:async"; import "../../../Utils/expect.dart"; diff --git a/LibTest/async/Stream/join_A02_t01.test.dart b/LibTest/async/Stream/join_A02_t01.test.dart index 1973da895e..648e3b46df 100644 --- a/LibTest/async/Stream/join_A02_t01.test.dart +++ b/LibTest/async/Stream/join_A02_t01.test.dart @@ -11,13 +11,14 @@ /// @author ilya library join_A02_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamWithErrorsFunction create) { Error error = new Error(); - Stream s = create([1, 2, error, 4, 5], isError: (e) => e is Error, - defaultValue: 42); + Stream s = + create([1, 2, error, 4, 5], isError: (e) => e is Error, defaultValue: 42); AsyncExpect.error(error, s.join()); } diff --git a/LibTest/async/Stream/join_A02_t02.test.dart b/LibTest/async/Stream/join_A02_t02.test.dart index 327bdead34..e0ab080f34 100644 --- a/LibTest/async/Stream/join_A02_t02.test.dart +++ b/LibTest/async/Stream/join_A02_t02.test.dart @@ -11,6 +11,7 @@ /// @author ilya library join_A02_t02; + import "dart:async"; import "../../../Utils/expect.dart"; diff --git a/LibTest/async/Stream/lastWhere_A01_t01.test.dart b/LibTest/async/Stream/lastWhere_A01_t01.test.dart index 60cba939ed..86f9635f2c 100644 --- a/LibTest/async/Stream/lastWhere_A01_t01.test.dart +++ b/LibTest/async/Stream/lastWhere_A01_t01.test.dart @@ -20,21 +20,21 @@ /// @author a.semenov@unipro.ru library lastWhere_A01_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { AsyncExpect.value(3, create([1, 2, 3]).lastWhere((element) => true)); - AsyncExpect.value(3, create([1, 2, 3]).lastWhere((int? element) => element != null)); + AsyncExpect.value( + 3, create([1, 2, 3]).lastWhere((int? element) => element != null)); AsyncExpect.value(null, create([1, 2, 3, null]).lastWhere((e) => e == null)); AsyncExpect.value(3, create([1, 2, 3]).lastWhere((element) => element > 0)); AsyncExpect.value( 45, create(new Iterable.generate(10, (int index) => index * 5)) - .lastWhere((int element) => element != 30) - ); + .lastWhere((int element) => element != 30)); AsyncExpect.value( 30, create(new Iterable.generate(10, (int index) => index * 5)) - .lastWhere((int element) => element == 30) - ); + .lastWhere((int element) => element == 30)); } diff --git a/LibTest/async/Stream/lastWhere_A01_t02.test.dart b/LibTest/async/Stream/lastWhere_A01_t02.test.dart index a8778394e2..56fa20b808 100644 --- a/LibTest/async/Stream/lastWhere_A01_t02.test.dart +++ b/LibTest/async/Stream/lastWhere_A01_t02.test.dart @@ -20,21 +20,21 @@ /// @author a.semenov@unipro.ru library lastWhere_A01_t02; + import "dart:async"; import "../../../Utils/expect.dart"; void check(Stream s, bool test(T element), T expected) { bool orElseCalled = false; asyncStart(); - s.lastWhere(test, orElse:() { + s.lastWhere(test, orElse: () { orElseCalled = true; return null as T; - }) - .then((T actual){ - Expect.equals(expected, actual); - Expect.isFalse(orElseCalled); - asyncEnd(); - }); + }).then((T actual) { + Expect.equals(expected, actual); + Expect.isFalse(orElseCalled); + asyncEnd(); + }); } void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/lastWhere_A02_t01.test.dart b/LibTest/async/Stream/lastWhere_A02_t01.test.dart index defd088a6c..f76a022c22 100644 --- a/LibTest/async/Stream/lastWhere_A02_t01.test.dart +++ b/LibTest/async/Stream/lastWhere_A02_t01.test.dart @@ -21,6 +21,7 @@ /// @author kaigorodov library lastWhere_A02_t01; + import "dart:async"; import "../../../Utils/expect.dart"; diff --git a/LibTest/async/Stream/lastWhere_A03_t01.test.dart b/LibTest/async/Stream/lastWhere_A03_t01.test.dart index bbb3e931b5..e8d9e38b29 100644 --- a/LibTest/async/Stream/lastWhere_A03_t01.test.dart +++ b/LibTest/async/Stream/lastWhere_A03_t01.test.dart @@ -31,9 +31,11 @@ void check(Stream s, bool test(T element), Object expectedError) { void test(CreateStreamWithErrorsFunction create) { check(create([1, 2, 3], isError: (e) => true, defaultValue: 42), - (x) => x > 0, 1); + (x) => x > 0, 1); check(create([1, 2, 3], isError: (e) => e == 3, defaultValue: 42), - (x) => x > 0, 3); - check(create([-1, 1, -2, 2, 3], isError: (e) => e == 3, defaultValue: 42), - (x) => x < 0, 3); + (x) => x > 0, 3); + check( + create([-1, 1, -2, 2, 3], isError: (e) => e == 3, defaultValue: 42), + (x) => x < 0, + 3); } diff --git a/LibTest/async/Stream/lastWhere_A05_t01.test.dart b/LibTest/async/Stream/lastWhere_A05_t01.test.dart index bbc5db445b..258c1d84a8 100644 --- a/LibTest/async/Stream/lastWhere_A05_t01.test.dart +++ b/LibTest/async/Stream/lastWhere_A05_t01.test.dart @@ -20,12 +20,15 @@ /// @author a.semenov@unipro library lastWhere_A05_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { AsyncExpect.error("a", create([1, 2, 3]).lastWhere((e) => throw "a")); AsyncExpect.error( "b", - create([1, 2, 3]).lastWhere((e) { if (e == 3) throw "b"; return true; }) - ); + create([1, 2, 3]).lastWhere((e) { + if (e == 3) throw "b"; + return true; + })); } diff --git a/LibTest/async/Stream/lastWhere_A06_t01.test.dart b/LibTest/async/Stream/lastWhere_A06_t01.test.dart index 5c6e60fcdb..b2c422ffe9 100644 --- a/LibTest/async/Stream/lastWhere_A06_t01.test.dart +++ b/LibTest/async/Stream/lastWhere_A06_t01.test.dart @@ -20,10 +20,11 @@ /// @author a.semenov@unipro library lastWhere_A06_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { - Stream s = create([1,2,3]); - AsyncExpect.error("z", s.lastWhere((e) => false, orElse:() => throw "z")); + Stream s = create([1, 2, 3]); + AsyncExpect.error("z", s.lastWhere((e) => false, orElse: () => throw "z")); } diff --git a/LibTest/async/Stream/last_A01_t01.test.dart b/LibTest/async/Stream/last_A01_t01.test.dart index 8687622298..aa19abb040 100644 --- a/LibTest/async/Stream/last_A01_t01.test.dart +++ b/LibTest/async/Stream/last_A01_t01.test.dart @@ -8,10 +8,11 @@ /// @author kaigorodov library last_A01_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { AsyncExpect.value(123, create([123]).last); - AsyncExpect.value(123, create([123/2, 123]).last); + AsyncExpect.value(123, create([123 / 2, 123]).last); AsyncExpect.value(9, create(new Iterable.generate(10, (int i) => i)).last); } diff --git a/LibTest/async/Stream/last_A02_t01.test.dart b/LibTest/async/Stream/last_A02_t01.test.dart index 42777d4d37..0862d7b485 100644 --- a/LibTest/async/Stream/last_A02_t01.test.dart +++ b/LibTest/async/Stream/last_A02_t01.test.dart @@ -10,6 +10,7 @@ /// @author kaigorodov library last_A02_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/last_A03_t01.test.dart b/LibTest/async/Stream/last_A03_t01.test.dart index 53c0adf357..f0b1b098cd 100644 --- a/LibTest/async/Stream/last_A03_t01.test.dart +++ b/LibTest/async/Stream/last_A03_t01.test.dart @@ -11,18 +11,17 @@ /// @author a.semenov@unipro.ru library last_A03_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamWithErrorsFunction create) { Error error = new Error(); - AsyncExpect.error( - error, - create( - [1, 2, error, 4, 5], isError: (e) => e is Error, defaultValue: 42).last); AsyncExpect.error( error, + create([1, 2, error, 4, 5], isError: (e) => e is Error, defaultValue: 42) + .last); + AsyncExpect.error(error, create([error, 4, 5], isError: (e) => e is Error, defaultValue: 42).last); - AsyncExpect.error( - error, + AsyncExpect.error(error, create([1, 2, error], isError: (e) => e is Error, defaultValue: 42).last); } diff --git a/LibTest/async/Stream/length_A01_t01.test.dart b/LibTest/async/Stream/length_A01_t01.test.dart index 41bf65d59a..85ca66d999 100644 --- a/LibTest/async/Stream/length_A01_t01.test.dart +++ b/LibTest/async/Stream/length_A01_t01.test.dart @@ -10,11 +10,14 @@ /// @author kaigorodov library length_A01_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { AsyncExpect.value(0, create([]).length); AsyncExpect.value(4, create([1, 2, 3, null]).length); - AsyncExpect.value(0, create(new Iterable.generate(0, (int i) => i * 2)).length); - AsyncExpect.value(10, create(new Iterable.generate(10, (int i) => i * 2)).length); + AsyncExpect.value( + 0, create(new Iterable.generate(0, (int i) => i * 2)).length); + AsyncExpect.value( + 10, create(new Iterable.generate(10, (int i) => i * 2)).length); } diff --git a/LibTest/async/Stream/length_A02_t01.test.dart b/LibTest/async/Stream/length_A02_t01.test.dart index 361271586d..bafd4eea98 100644 --- a/LibTest/async/Stream/length_A02_t01.test.dart +++ b/LibTest/async/Stream/length_A02_t01.test.dart @@ -18,7 +18,9 @@ void test(CreateStreamWithErrorsFunction create) { 1, create([1], isError: (_) => true, defaultValue: 42).length); AsyncExpect.error(3, create([1, 2, 3, null], isError: (e) => e == 3, defaultValue: 42).length); - AsyncExpect.error(12, + AsyncExpect.error( + 12, create(new Iterable.generate(10, (int i) => i * 2), - isError: (e) => e > 10, defaultValue: 42).length); + isError: (e) => e > 10, defaultValue: 42) + .length); } diff --git a/LibTest/async/Stream/listen_A01_t01.test.dart b/LibTest/async/Stream/listen_A01_t01.test.dart index 522bf19df8..1ff839dad4 100644 --- a/LibTest/async/Stream/listen_A01_t01.test.dart +++ b/LibTest/async/Stream/listen_A01_t01.test.dart @@ -12,21 +12,19 @@ /// @author kaigorodov library listen_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void check(Stream s, Iterable expectedData) { List sink = new List.empty(growable: true); asyncStart(); - s.listen( - (T event) { - sink.add(event); - }, - onDone: () { - Expect.listEquals(expectedData, sink); - asyncEnd(); - } - ); + s.listen((T event) { + sink.add(event); + }, onDone: () { + Expect.listEquals(expectedData, sink); + asyncEnd(); + }); } void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/listen_A02_t01.test.dart b/LibTest/async/Stream/listen_A02_t01.test.dart index 2b20359838..01dd8d4aa6 100644 --- a/LibTest/async/Stream/listen_A02_t01.test.dart +++ b/LibTest/async/Stream/listen_A02_t01.test.dart @@ -10,16 +10,15 @@ /// @author kaigorodov library listen_A02_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void check(Stream s) { asyncStart(); - s.listen(null, - onDone: () { - asyncEnd(); - } - ); + s.listen(null, onDone: () { + asyncEnd(); + }); } void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/listen_A03_t01.test.dart b/LibTest/async/Stream/listen_A03_t01.test.dart index a5781a27eb..9788b061e5 100644 --- a/LibTest/async/Stream/listen_A03_t01.test.dart +++ b/LibTest/async/Stream/listen_A03_t01.test.dart @@ -34,11 +34,13 @@ void test(CreateStreamWithErrorsFunction create) { check(create([], defaultValue: 42), [], []); check(create([1, 2, 3, 4], isError: (x) => false, defaultValue: 42), [1, 2, 3, 4], []); - check(create([1, 2, 3, 4], isError: (x) => true, defaultValue: 42), - [], [1, 2, 3, 4]); + check(create([1, 2, 3, 4], isError: (x) => true, defaultValue: 42), [], + [1, 2, 3, 4]); check(create([1, 2, 3, 4], isError: (x) => x.isOdd, defaultValue: 42), [2, 4], [1, 3]); - check(create( - [null, "2", -3, 4.0, []], isError: (x) => x is num, defaultValue: 42), - [null, "2", []], [-3, 4.0]); + check( + create([null, "2", -3, 4.0, []], + isError: (x) => x is num, defaultValue: 42), + [null, "2", []], + [-3, 4.0]); } diff --git a/LibTest/async/Stream/listen_A04_t01.test.dart b/LibTest/async/Stream/listen_A04_t01.test.dart index c539c3ce44..478faedace 100644 --- a/LibTest/async/Stream/listen_A04_t01.test.dart +++ b/LibTest/async/Stream/listen_A04_t01.test.dart @@ -13,6 +13,7 @@ /// @author a.semenov@unipro.ru library listen_A04_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -20,39 +21,36 @@ void check(Stream s, List data, List errors) { List dataSink = []; List errorSink = []; asyncStart(); - s.listen( - (T event) { - dataSink.add(event); - }, - onError: (Object error) { - errorSink.add(error); - // wait for possible additional error - new Future.delayed(durationInMilliseconds(500), (){ - Expect.listEquals(data, dataSink); - Expect.listEquals(errors, errorSink); - asyncEnd(); - }); - }, - onDone: () { - // onDone is only called if there were no errors - Expect.listEquals(data, dataSink); - Expect.listEquals(errors, errorSink); - asyncEnd(); - }, - cancelOnError: true - ); + s.listen((T event) { + dataSink.add(event); + }, onError: (Object error) { + errorSink.add(error); + // wait for possible additional error + new Future.delayed(durationInMilliseconds(500), () { + Expect.listEquals(data, dataSink); + Expect.listEquals(errors, errorSink); + asyncEnd(); + }); + }, onDone: () { + // onDone is only called if there were no errors + Expect.listEquals(data, dataSink); + Expect.listEquals(errors, errorSink); + asyncEnd(); + }, cancelOnError: true); } void test(CreateStreamWithErrorsFunction create) { check(create([], defaultValue: 42), [], []); - check(create([1, 2, 3, 4], isError:(x) => false, defaultValue: 42), + check(create([1, 2, 3, 4], isError: (x) => false, defaultValue: 42), [1, 2, 3, 4], []); - check(create([1, 2, 3, 4], isError:(x) => true, defaultValue: 42), [], [1]); - check(create([1, 2, 3, 4], isError:(x) => x.isOdd, defaultValue: 42), - [], [1]); - check(create([1, 2, 3, 4], isError:(x) => x.isEven, defaultValue: 42), + check(create([1, 2, 3, 4], isError: (x) => true, defaultValue: 42), [], [1]); + check( + create([1, 2, 3, 4], isError: (x) => x.isOdd, defaultValue: 42), [], [1]); + check(create([1, 2, 3, 4], isError: (x) => x.isEven, defaultValue: 42), [1], [2]); - check(create( - [null, "2", -3, 4.0, []], isError:(x) => x is num, defaultValue: 42), - [null, "2"], [-3]); + check( + create([null, "2", -3, 4.0, []], + isError: (x) => x is num, defaultValue: 42), + [null, "2"], + [-3]); } diff --git a/LibTest/async/Stream/listen_A05_t02.dart b/LibTest/async/Stream/listen_A05_t02.dart index 5cb6b339ee..30ea40b78f 100644 --- a/LibTest/async/Stream/listen_A05_t02.dart +++ b/LibTest/async/Stream/listen_A05_t02.dart @@ -22,7 +22,7 @@ main() { var s; try { throw error; - } catch (e,st) { + } catch (e, st) { stackTrace = st; s = new Stream.fromFuture(new Future.error(e, st)); } diff --git a/LibTest/async/Stream/listen_A06_t01.test.dart b/LibTest/async/Stream/listen_A06_t01.test.dart index bf7ff818db..4c1ca213bd 100644 --- a/LibTest/async/Stream/listen_A06_t01.test.dart +++ b/LibTest/async/Stream/listen_A06_t01.test.dart @@ -9,18 +9,25 @@ /// @author ilya library listen_A06_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { asyncStart(); - create([]).listen((_) {}, onDone: () {asyncEnd();}); + create([]).listen((_) {}, onDone: () { + asyncEnd(); + }); asyncStart(); - create([1]).listen((_) {}, onDone: () {asyncEnd();}); + create([1]).listen((_) {}, onDone: () { + asyncEnd(); + }); asyncStart(); Stream s = create([1]).asBroadcastStream(); s.single.then((_) {}); - s.listen((_) {}, onDone: () {asyncEnd();}); + s.listen((_) {}, onDone: () { + asyncEnd(); + }); } diff --git a/LibTest/async/Stream/map_A02_t01.test.dart b/LibTest/async/Stream/map_A02_t01.test.dart index 852633bf1e..2387798ca6 100644 --- a/LibTest/async/Stream/map_A02_t01.test.dart +++ b/LibTest/async/Stream/map_A02_t01.test.dart @@ -12,6 +12,7 @@ /// @author a.semenov@unipro.ru library map_A02_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -20,5 +21,6 @@ void test(CreateStreamFunction create) { AsyncExpect.events([], ["a", "b", "c"], stream.map((e) => throw e)); stream = create([1, 2, 3, 4, 5]); - AsyncExpect.events([1, 3, 5], [2, 4], stream.map((e) => e.isOdd ? e : throw e)); + AsyncExpect.events( + [1, 3, 5], [2, 4], stream.map((e) => e.isOdd ? e : throw e)); } diff --git a/LibTest/async/Stream/map_A03_t01.test.dart b/LibTest/async/Stream/map_A03_t01.test.dart index 112e576b6d..78d369bfe2 100644 --- a/LibTest/async/Stream/map_A03_t01.test.dart +++ b/LibTest/async/Stream/map_A03_t01.test.dart @@ -9,13 +9,15 @@ /// @author a.semenov@unipro.ru library map_A03_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamWithErrorsFunction create) { - Stream stream = create(["a", "b", "c"], isError:(e) => true, defaultValue: ""); + Stream stream = + create(["a", "b", "c"], isError: (e) => true, defaultValue: ""); AsyncExpect.events([], ["a", "b", "c"], stream.map((e) => e)); - stream = create([1, 2, 3, 4, 5], isError:(e) => e.isEven, defaultValue: 42); + stream = create([1, 2, 3, 4, 5], isError: (e) => e.isEven, defaultValue: 42); AsyncExpect.events([1, 3, 5], [2, 4], stream.map((e) => e)); } diff --git a/LibTest/async/Stream/map_A04_t01.test.dart b/LibTest/async/Stream/map_A04_t01.test.dart index bdb59bcd7d..28d9fb52ae 100644 --- a/LibTest/async/Stream/map_A04_t01.test.dart +++ b/LibTest/async/Stream/map_A04_t01.test.dart @@ -10,6 +10,7 @@ /// @author a.semenov@unipro.ru library map_A04_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -18,19 +19,18 @@ void check(Stream stream, dynamic convert(T event)) { } void test(CreateStreamFunction create) { - check(create([]), (_) => null); check(create([]).asBroadcastStream(), (_) => null); - check(create([1,2,3,4,5]), (_) => null); - check(create([1,2,3,4,5]).asBroadcastStream(), (_) => null); + check(create([1, 2, 3, 4, 5]), (_) => null); + check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (_) => null); check(create([]), (e) => e); check(create([]).asBroadcastStream(), (e) => e); - check(create([1,2,3,4,5]), (e) => e); - check(create([1,2,3,4,5]).asBroadcastStream(), (e) => e); + check(create([1, 2, 3, 4, 5]), (e) => e); + check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (e) => e); - check(create([1,2,3,4,5]), (e) => e.toString()); - check(create([1,2,3,4,5]).asBroadcastStream(), (e) => e.toString()); + check(create([1, 2, 3, 4, 5]), (e) => e.toString()); + check(create([1, 2, 3, 4, 5]).asBroadcastStream(), (e) => e.toString()); } diff --git a/LibTest/async/Stream/map_A05_t01.test.dart b/LibTest/async/Stream/map_A05_t01.test.dart index 2d611c2d30..2537ba3077 100644 --- a/LibTest/async/Stream/map_A05_t01.test.dart +++ b/LibTest/async/Stream/map_A05_t01.test.dart @@ -13,25 +13,23 @@ /// @author a.semenov@unipro.ru library map_A05_t01; + import "dart:async"; import "../../../Utils/expect.dart"; Future> subscribe(Stream stream) { Completer> completer = new Completer>(); List received = []; - stream.listen( - (T event) { - received.add(event); - }, - onDone: () { - completer.complete(received); - } - ); + stream.listen((T event) { + received.add(event); + }, onDone: () { + completer.complete(received); + }); return completer.future; } void check(Stream stream, List expected) { - Map convertLog = new Map(); + Map convertLog = new Map(); T convert(T event) { convertLog[event] = 1 + convertLog.putIfAbsent(event, () => 0); @@ -40,17 +38,13 @@ void check(Stream stream, List expected) { asyncStart(); Stream converted = stream.map(convert); - Future.wait([ - subscribe(converted), - subscribe(converted), - subscribe(converted) - ]).then( - (List> result) { - result.forEach((received) => Expect.listEquals(expected, received)); - expected.forEach((event) => Expect.equals(3, convertLog[event])); - asyncEnd(); - } - ); + Future.wait( + [subscribe(converted), subscribe(converted), subscribe(converted)]) + .then((List> result) { + result.forEach((received) => Expect.listEquals(expected, received)); + expected.forEach((event) => Expect.equals(3, convertLog[event])); + asyncEnd(); + }); } void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/pipe_A01_t01.test.dart b/LibTest/async/Stream/pipe_A01_t01.test.dart index d8e124780c..bd0e327c83 100644 --- a/LibTest/async/Stream/pipe_A01_t01.test.dart +++ b/LibTest/async/Stream/pipe_A01_t01.test.dart @@ -8,6 +8,7 @@ /// @author ilya library pipe_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; diff --git a/LibTest/async/Stream/pipe_A01_t02.test.dart b/LibTest/async/Stream/pipe_A01_t02.test.dart index 65085161a0..ae7c20f447 100644 --- a/LibTest/async/Stream/pipe_A01_t02.test.dart +++ b/LibTest/async/Stream/pipe_A01_t02.test.dart @@ -9,15 +9,15 @@ /// @author a.semenov@unipro.ru library pipe_A01_t02; + import "dart:async"; import "../../../Utils/expect.dart"; class TestStreamConsumer implements StreamConsumer { - StreamController _controller = new StreamController(); Future addStream(Stream source) { - return _controller.addStream(source, cancelOnError:false); + return _controller.addStream(source, cancelOnError: false); } Future close() { @@ -32,17 +32,14 @@ void test(CreateStreamWithErrorsFunction create) { List errors = []; TestStreamConsumer c = new TestStreamConsumer(); - c.stream.listen( - (x) { - values.add(x); - }, - onError:(error) { - errors.add(error); - } - ); + c.stream.listen((x) { + values.add(x); + }, onError: (error) { + errors.add(error); + }); Stream s = - create([1, 2, 3, 4, 5], isError:(x) => x.isEven, defaultValue: 42); + create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42); asyncStart(); s.pipe(c).then((x) { diff --git a/LibTest/async/Stream/pipe_A02_t01.test.dart b/LibTest/async/Stream/pipe_A02_t01.test.dart index 2f381277e9..97979c44a1 100644 --- a/LibTest/async/Stream/pipe_A02_t01.test.dart +++ b/LibTest/async/Stream/pipe_A02_t01.test.dart @@ -13,23 +13,21 @@ /// @author a.semenov@unipro.ru library pipe_A02_t01; + import "dart:async"; import "../../../Utils/expect.dart"; class TestStreamConsumer implements StreamConsumer { - int _addStreamFutureCompleted = 0; int _addStreamFutureCompletedInClose = 0; int _closeCallCount = 0; StreamController _controller = new StreamController(); Future addStream(Stream source) { - return _controller.addStream(source).then( - (x) { - _addStreamFutureCompleted++; - return x; - } - ); + return _controller.addStream(source).then((x) { + _addStreamFutureCompleted++; + return x; + }); } Future close() { @@ -47,21 +45,17 @@ void test(CreateStreamFunction create) { List values = []; TestStreamConsumer c = new TestStreamConsumer(); - c.stream.listen( - (x) { - values.add(x); - } - ); + c.stream.listen((x) { + values.add(x); + }); Stream s = create([1, 2, 3, 4, 5]); asyncStart(); - s.pipe(c).then( - (x) { - Expect.listEquals([1, 2, 3, 4, 5], values); - Expect.equals(1, c.closeCallCount); - Expect.equals(1, c.addStreamFutureCompletedInClose); - asyncEnd(); - } - ); + s.pipe(c).then((x) { + Expect.listEquals([1, 2, 3, 4, 5], values); + Expect.equals(1, c.closeCallCount); + Expect.equals(1, c.addStreamFutureCompletedInClose); + asyncEnd(); + }); } diff --git a/LibTest/async/Stream/pipe_A03_t01.test.dart b/LibTest/async/Stream/pipe_A03_t01.test.dart index 6f3ac216f1..93a19936df 100644 --- a/LibTest/async/Stream/pipe_A03_t01.test.dart +++ b/LibTest/async/Stream/pipe_A03_t01.test.dart @@ -13,31 +13,27 @@ /// @author a.semenov@unipro.ru library pipe_A03_t01; + import "dart:async"; import "../../../Utils/expect.dart"; class TestStreamConsumer implements StreamConsumer { - bool _addStreamFutureCompleted = false; bool _closeFutureCompleted = false; StreamController _controller = new StreamController(); Future addStream(Stream source) { - return _controller.addStream(source, cancelOnError:false).then( - (x) { - _addStreamFutureCompleted = true; - return x; - } - ); + return _controller.addStream(source, cancelOnError: false).then((x) { + _addStreamFutureCompleted = true; + return x; + }); } Future close() { - return _controller.close().then( - (_) { - _closeFutureCompleted = true; - return 3.14; - } - ); + return _controller.close().then((_) { + _closeFutureCompleted = true; + return 3.14; + }); } Stream get stream => _controller.stream; @@ -49,11 +45,9 @@ void test(CreateStreamFunction create) { List values = []; TestStreamConsumer c = new TestStreamConsumer(); - c.stream.listen( - (x) { - values.add(x); - } - ); + c.stream.listen((x) { + values.add(x); + }); Stream s = create([1, 2, 3, 4, 5]); diff --git a/LibTest/async/Stream/pipe_A03_t02.test.dart b/LibTest/async/Stream/pipe_A03_t02.test.dart index bc4b0b8604..eaed9c6050 100644 --- a/LibTest/async/Stream/pipe_A03_t02.test.dart +++ b/LibTest/async/Stream/pipe_A03_t02.test.dart @@ -13,31 +13,27 @@ /// @author a.semenov@unipro.ru library pipe_A03_t02; + import "dart:async"; import "../../../Utils/expect.dart"; class TestStreamConsumer implements StreamConsumer { - bool _addStreamFutureCompleted = false; bool _closeFutureCompleted = false; StreamController _controller = new StreamController(); Future addStream(Stream source) { - return _controller.addStream(source, cancelOnError:false).then( - (x) { - _addStreamFutureCompleted = true; - return x; - } - ); + return _controller.addStream(source, cancelOnError: false).then((x) { + _addStreamFutureCompleted = true; + return x; + }); } Future close() { - return _controller.close().then( - (_) { - _closeFutureCompleted = true; - return new Future.error(3.14); - } - ); + return _controller.close().then((_) { + _closeFutureCompleted = true; + return new Future.error(3.14); + }); } Stream get stream => _controller.stream; @@ -49,25 +45,20 @@ void test(CreateStreamFunction create) { List values = []; TestStreamConsumer c = new TestStreamConsumer(); - c.stream.listen( - (x) { - values.add(x); - } - ); + c.stream.listen((x) { + values.add(x); + }); Stream s = create([1, 2, 3, 4, 5]); asyncStart(); - s.pipe(c).then( - (x) { - Expect.fail("Returned future should complete with error"); - }, - onError: (e) { - Expect.equals(3.14, e); - Expect.isTrue(c.addStreamFutureCompleted); - Expect.isTrue(c.closeFutureCompleted); - Expect.listEquals([1, 2, 3, 4, 5], values); - asyncEnd(); - } - ); + s.pipe(c).then((x) { + Expect.fail("Returned future should complete with error"); + }, onError: (e) { + Expect.equals(3.14, e); + Expect.isTrue(c.addStreamFutureCompleted); + Expect.isTrue(c.closeFutureCompleted); + Expect.listEquals([1, 2, 3, 4, 5], values); + asyncEnd(); + }); } diff --git a/LibTest/async/Stream/pipe_A04_t01.test.dart b/LibTest/async/Stream/pipe_A04_t01.test.dart index adadf4d943..19be595fbd 100644 --- a/LibTest/async/Stream/pipe_A04_t01.test.dart +++ b/LibTest/async/Stream/pipe_A04_t01.test.dart @@ -11,6 +11,7 @@ /// @author a.semenov@unipro.ru library pipe_A04_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -34,15 +35,12 @@ void test(CreateStreamFunction create) { Stream s = create([1, 2, 3, 4, 5]); asyncStart(); - s.pipe(c).then( - (_) { - Expect.fail("Returned future should complete with error"); - }, - onError:(e) { - Expect.equals("addStreamError", e); - Expect.equals(0, c.closeCallCount); - - asyncEnd(); - } - ); + s.pipe(c).then((_) { + Expect.fail("Returned future should complete with error"); + }, onError: (e) { + Expect.equals("addStreamError", e); + Expect.equals(0, c.closeCallCount); + + asyncEnd(); + }); } diff --git a/LibTest/async/Stream/pipe_A04_t02.test.dart b/LibTest/async/Stream/pipe_A04_t02.test.dart index dc37140e1e..5f97def89a 100644 --- a/LibTest/async/Stream/pipe_A04_t02.test.dart +++ b/LibTest/async/Stream/pipe_A04_t02.test.dart @@ -11,6 +11,7 @@ /// @author a.semenov@unipro.ru library pipe_A04_t02; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -19,12 +20,10 @@ class TestStreamConsumer implements StreamConsumer { StreamController _controller = new StreamController(); Future addStream(Stream source) { - return _controller.addStream(source).then( - (_) { - _controller.close(); - return new Future.error("addStreamError"); - } - ); + return _controller.addStream(source).then((_) { + _controller.close(); + return new Future.error("addStreamError"); + }); } Future close() { @@ -42,25 +41,19 @@ void test(CreateStreamFunction create) { Stream s = create([1, 2, 3, 4, 5]); - c.stream.listen( - (x) { - values.add(x); - }, - onDone:(){ - Expect.listEquals([1, 2, 3, 4, 5], values); - asyncEnd(); - } - ); + c.stream.listen((x) { + values.add(x); + }, onDone: () { + Expect.listEquals([1, 2, 3, 4, 5], values); + asyncEnd(); + }); asyncStart(2); - s.pipe(c).then( - (_) { - Expect.fail("Returned future should complete with error"); - }, - onError:(e) { - Expect.equals("addStreamError", e); - Expect.equals(0, c.closeCallCount); - asyncEnd(); - } - ); + s.pipe(c).then((_) { + Expect.fail("Returned future should complete with error"); + }, onError: (e) { + Expect.equals("addStreamError", e); + Expect.equals(0, c.closeCallCount); + asyncEnd(); + }); } diff --git a/LibTest/async/Stream/reduce_A01_t01.test.dart b/LibTest/async/Stream/reduce_A01_t01.test.dart index e053bcf3df..2b68babbfc 100644 --- a/LibTest/async/Stream/reduce_A01_t01.test.dart +++ b/LibTest/async/Stream/reduce_A01_t01.test.dart @@ -8,6 +8,7 @@ /// @author kaigorodov library reduce_A01_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/reduce_A01_t02.test.dart b/LibTest/async/Stream/reduce_A01_t02.test.dart index 76d584cbc5..2c239ec642 100644 --- a/LibTest/async/Stream/reduce_A01_t02.test.dart +++ b/LibTest/async/Stream/reduce_A01_t02.test.dart @@ -10,16 +10,14 @@ /// @author kaigorodov library reduce_A01_t02; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { - int combine(int p, int e){ + int combine(int p, int e) { Expect.fail("combine should not be called"); return 0; // makes analyzer happy } - AsyncExpect.value( - 777, - create([777]).reduce(combine) - ); + AsyncExpect.value(777, create([777]).reduce(combine)); } diff --git a/LibTest/async/Stream/reduce_A01_t03.test.dart b/LibTest/async/Stream/reduce_A01_t03.test.dart index 2f5641fdad..88f41dc015 100644 --- a/LibTest/async/Stream/reduce_A01_t03.test.dart +++ b/LibTest/async/Stream/reduce_A01_t03.test.dart @@ -10,8 +10,9 @@ /// @author kaigorodov library reduce_A01_t03; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { - AsyncExpect.error((e) => e is Error, create([]).reduce((p,e) => 0)); + AsyncExpect.error((e) => e is Error, create([]).reduce((p, e) => 0)); } diff --git a/LibTest/async/Stream/reduce_A01_t04.test.dart b/LibTest/async/Stream/reduce_A01_t04.test.dart index e162ed6e98..cf45d0f440 100644 --- a/LibTest/async/Stream/reduce_A01_t04.test.dart +++ b/LibTest/async/Stream/reduce_A01_t04.test.dart @@ -9,6 +9,7 @@ /// @author a.semenov@unipro.ru library reduce_A01_t04; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -23,11 +24,9 @@ void test(CreateStreamFunction create) { Stream s = create([1, 2, 3, 4]); asyncStart(); - s.reduce(combine).then( - (value) { - Expect.equals(10, value); - Expect.listEquals([1, 2, 3, 3, 6, 4], log); - asyncEnd(); - } - ); + s.reduce(combine).then((value) { + Expect.equals(10, value); + Expect.listEquals([1, 2, 3, 3, 6, 4], log); + asyncEnd(); + }); } diff --git a/LibTest/async/Stream/reduce_A02_t01.test.dart b/LibTest/async/Stream/reduce_A02_t01.test.dart index 41a91892ab..5110d4c692 100644 --- a/LibTest/async/Stream/reduce_A02_t01.test.dart +++ b/LibTest/async/Stream/reduce_A02_t01.test.dart @@ -9,17 +9,16 @@ /// @author a.semenov@unipro.ru library reduce_A02_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { - AsyncExpect.error("a", create([1, 2, 3]).reduce((p,e) => throw "a")); - AsyncExpect.error(2, create([1, 2, 3]).reduce((p,e) => throw e)); - AsyncExpect.error(3, - create([1, 2, 3, 4, 5]).reduce( - (p, e) { - if (e==3) throw e; - return p + e; - } - ) - ); + AsyncExpect.error("a", create([1, 2, 3]).reduce((p, e) => throw "a")); + AsyncExpect.error(2, create([1, 2, 3]).reduce((p, e) => throw e)); + AsyncExpect.error( + 3, + create([1, 2, 3, 4, 5]).reduce((p, e) { + if (e == 3) throw e; + return p + e; + })); } diff --git a/LibTest/async/Stream/reduce_A03_t01.test.dart b/LibTest/async/Stream/reduce_A03_t01.test.dart index 8693ddceb3..123297afae 100644 --- a/LibTest/async/Stream/reduce_A03_t01.test.dart +++ b/LibTest/async/Stream/reduce_A03_t01.test.dart @@ -20,8 +20,10 @@ void check(Stream s, T combine(T p, T e), Object expected) { void test(CreateStreamWithErrorsFunction create) { check(create([1, 2, 3, 4, 5], isError: (_) => true, defaultValue: 42), (int p, int e) => p + e, 1); - check(create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), - (int p, int e) => p * e, 2); + check( + create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), + (int p, int e) => p * e, + 2); check(create([1, 2, 3, 4, 5], isError: (x) => x == 5, defaultValue: 42), (int p, int e) => p + e, 5); } diff --git a/LibTest/async/Stream/singleWhere_A01_t01.test.dart b/LibTest/async/Stream/singleWhere_A01_t01.test.dart index fae7e1c505..f672636245 100644 --- a/LibTest/async/Stream/singleWhere_A01_t01.test.dart +++ b/LibTest/async/Stream/singleWhere_A01_t01.test.dart @@ -10,6 +10,7 @@ /// @author kaigorodov library singleWhere_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -20,9 +21,6 @@ void check(Stream s, bool test(T element), T expected) { void test(CreateStreamFunction create) { check(create([1, 2, 3, null]), (int? element) => element == null, null); check(create([1, 2, 3]), (int element) => element > 2, 3); - check( - create(new Iterable.generate(10, (int index) => index * 5)), - (int element) => element == 30, - 30 - ); + check(create(new Iterable.generate(10, (int index) => index * 5)), + (int element) => element == 30, 30); } diff --git a/LibTest/async/Stream/single_A01_t01.test.dart b/LibTest/async/Stream/single_A01_t01.test.dart index 1d4b749dbf..d6a5d0079f 100644 --- a/LibTest/async/Stream/single_A01_t01.test.dart +++ b/LibTest/async/Stream/single_A01_t01.test.dart @@ -8,6 +8,7 @@ /// @author kaigorodov library single_A01_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/single_A02_t01.test.dart b/LibTest/async/Stream/single_A02_t01.test.dart index 1327eea546..917e725b8e 100644 --- a/LibTest/async/Stream/single_A02_t01.test.dart +++ b/LibTest/async/Stream/single_A02_t01.test.dart @@ -10,6 +10,7 @@ /// @author kaigorodov library single_A02_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/skipWhile_A01_t01.test.dart b/LibTest/async/Stream/skipWhile_A01_t01.test.dart index 4338ccf33c..f842b6cfc4 100644 --- a/LibTest/async/Stream/skipWhile_A01_t01.test.dart +++ b/LibTest/async/Stream/skipWhile_A01_t01.test.dart @@ -11,12 +11,14 @@ /// @author kaigorodov library skipWhile_A01_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { AsyncExpect.data([], create([]).skipWhile((_) => false)); AsyncExpect.data([1, 2, 3], create([1, 2, 3]).skipWhile((element) => false)); - AsyncExpect.data([1, 2, 3], create([-1, -2, -3, 1, 2, 3]).skipWhile((e) => e < 0)); + AsyncExpect.data( + [1, 2, 3], create([-1, -2, -3, 1, 2, 3]).skipWhile((e) => e < 0)); AsyncExpect.data([2, 3], create([1, 2, 3]).skipWhile((e) => e == 1)); AsyncExpect.data([], create([1, 2, 3]).skipWhile((element) => true)); } diff --git a/LibTest/async/Stream/skipWhile_A02_t01.test.dart b/LibTest/async/Stream/skipWhile_A02_t01.test.dart index f5653435b3..ffa7cd9a41 100644 --- a/LibTest/async/Stream/skipWhile_A02_t01.test.dart +++ b/LibTest/async/Stream/skipWhile_A02_t01.test.dart @@ -26,11 +26,16 @@ void test(CreateStreamWithErrorsFunction create) { [], [1, 2, 3]); check( create([1, 2, 3, 4, 5], isError: (x) => x.isOdd, defaultValue: 42), - (x) => x < 4, [4], [1, 3, 5]); + (x) => x < 4, + [4], + [1, 3, 5]); check(create([1, 2, 3, 4, 5], isError: (x) => x.isOdd, defaultValue: 42), (x) => x == 1, [2, 4], [1, 3, 5]); - check(create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), - (x) => x == 1, [3, 5], [2, 4]); + check( + create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), + (x) => x == 1, + [3, 5], + [2, 4]); check(create([1, 2, 3, 4, 5], isError: (x) => x < 5, defaultValue: 42), (x) => x == 5, [], [1, 2, 3, 4]); } diff --git a/LibTest/async/Stream/skipWhile_A03_t01.test.dart b/LibTest/async/Stream/skipWhile_A03_t01.test.dart index 3941996694..0349c03bbd 100644 --- a/LibTest/async/Stream/skipWhile_A03_t01.test.dart +++ b/LibTest/async/Stream/skipWhile_A03_t01.test.dart @@ -9,6 +9,7 @@ /// @author a.semenov@unipro.ru library skipWhile_A03_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -27,8 +28,8 @@ void test(CreateStreamFunction create) { check(create([null]).asBroadcastStream(), (x) => false); check(create([1, 2, 3]), (x) => false); check(create([1, 2, 3]).asBroadcastStream(), (x) => false); - check(create([1, 2, 3]), (x) => x==1); - check(create([1, 2, 3]).asBroadcastStream(), (x) => x==1); + check(create([1, 2, 3]), (x) => x == 1); + check(create([1, 2, 3]).asBroadcastStream(), (x) => x == 1); check(create([1, 2, 3]), (x) => true); check(create([1, 2, 3]).asBroadcastStream(), (x) => true); } diff --git a/LibTest/async/Stream/skipWhile_A04_t01.test.dart b/LibTest/async/Stream/skipWhile_A04_t01.test.dart index c96bf1e3ee..ffe38f586c 100644 --- a/LibTest/async/Stream/skipWhile_A04_t01.test.dart +++ b/LibTest/async/Stream/skipWhile_A04_t01.test.dart @@ -17,21 +17,21 @@ /// @author a.semenov@unipro.ru library skipWhile_A04_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { AsyncExpect.data([], create([]).skipWhile((e) => throw "a")); - AsyncExpect.events([2, 3], ["b"], create([1, 2, 3]).skipWhile((e) => throw "b")); + AsyncExpect.events( + [2, 3], ["b"], create([1, 2, 3]).skipWhile((e) => throw "b")); AsyncExpect.events( [2, 3], // expected data - ["c"], // expected errors - create([-1, -2, -3, 1, 2, 3]).skipWhile( - (element) { - if (element > 0) { - throw "c"; - }; - return true; + ["c"], // expected errors + create([-1, -2, -3, 1, 2, 3]).skipWhile((element) { + if (element > 0) { + throw "c"; } - ) - ); + ; + return true; + })); } diff --git a/LibTest/async/Stream/skip_A01_t01.test.dart b/LibTest/async/Stream/skip_A01_t01.test.dart index 6d40af0c65..eb6bff9a18 100644 --- a/LibTest/async/Stream/skip_A01_t01.test.dart +++ b/LibTest/async/Stream/skip_A01_t01.test.dart @@ -8,6 +8,7 @@ /// @author kaigorodov library skip_A01_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { @@ -21,5 +22,17 @@ void test(CreateStreamFunction create) { AsyncExpect.data([2, 3], create([1, 2, 3]).skip(1)); AsyncExpect.data([3], create([1, 2, 3]).skip(2)); AsyncExpect.data([], create([1, 2, 3]).skip(12)); - AsyncExpect.data([[[[]]]], create([[], [[]], [[[]]]]).skip(2)); + AsyncExpect.data( + [ + [ + [[]] + ] + ], + create([ + [], + [[]], + [ + [[]] + ] + ]).skip(2)); } diff --git a/LibTest/async/Stream/skip_A02_t01.test.dart b/LibTest/async/Stream/skip_A02_t01.test.dart index 42263389cc..1e1c7800e3 100644 --- a/LibTest/async/Stream/skip_A02_t01.test.dart +++ b/LibTest/async/Stream/skip_A02_t01.test.dart @@ -9,6 +9,7 @@ /// @author a.semenov@unipro.ru library skip_A02_t01; + import "dart:async"; import "../../../Utils/expect.dart"; diff --git a/LibTest/async/Stream/skip_A03_t01.test.dart b/LibTest/async/Stream/skip_A03_t01.test.dart index 56e3b822aa..72b181ccae 100644 --- a/LibTest/async/Stream/skip_A03_t01.test.dart +++ b/LibTest/async/Stream/skip_A03_t01.test.dart @@ -26,13 +26,19 @@ void test(CreateStreamWithErrorsFunction create) { AsyncExpect.events([], [1, 2, 3], create([1, 2, 3], isError: (_) => true, defaultValue: 42).skip(10)); - AsyncExpect.events([], [1, 3, 5], + AsyncExpect.events( + [], + [1, 3, 5], create([1, 2, 3, 4, 5], isError: (x) => x.isOdd, defaultValue: 42) .skip(10)); - AsyncExpect.events([3, 5], [2, 4], + AsyncExpect.events( + [3, 5], + [2, 4], create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42) .skip(1)); - AsyncExpect.events([5], [2, 4], + AsyncExpect.events( + [5], + [2, 4], create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42) .skip(2)); } diff --git a/LibTest/async/Stream/takeWhile_A01_t01.test.dart b/LibTest/async/Stream/takeWhile_A01_t01.test.dart index 6c5cb47b09..d774442b02 100644 --- a/LibTest/async/Stream/takeWhile_A01_t01.test.dart +++ b/LibTest/async/Stream/takeWhile_A01_t01.test.dart @@ -14,15 +14,15 @@ /// @author a.semenov@unipro.ru library takeWhile_A01_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { AsyncExpect.data([], create([]).takeWhile((_) => false)); - AsyncExpect.data( - [-1, -2, -3], - create([-1, -2, -3, 1, 2, 3, -1, -2, -3]).takeWhile((x) => x < 0) - ); + AsyncExpect.data([-1, -2, -3], + create([-1, -2, -3, 1, 2, 3, -1, -2, -3]).takeWhile((x) => x < 0)); AsyncExpect.data([1, 2, 3], create([1, 2, 3]).takeWhile((element) => true)); - AsyncExpect.data([1], create([1, 2, 3, 1]).takeWhile((element) => element == 1)); + AsyncExpect.data( + [1], create([1, 2, 3, 1]).takeWhile((element) => element == 1)); AsyncExpect.data([], create([1, 2, 3]).takeWhile((element) => false)); } diff --git a/LibTest/async/Stream/takeWhile_A01_t02.test.dart b/LibTest/async/Stream/takeWhile_A01_t02.test.dart index 896692a2ae..bb86462dc5 100644 --- a/LibTest/async/Stream/takeWhile_A01_t02.test.dart +++ b/LibTest/async/Stream/takeWhile_A01_t02.test.dart @@ -33,12 +33,17 @@ void test(CreateStreamWithErrorsFunction create) { (x) => false, [], [1]); check( create([1, 2, 3, 4, 5], isError: (x) => x.isOdd, defaultValue: 42), - (x) => x < 4, [2], [1, 3]); - check(create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), + (x) => x < 4, + [2], + [1, 3]); + check( + create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), (x) => false, [], []); check( create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), - (x) => x < 4, [1, 3], [2, 4]); + (x) => x < 4, + [1, 3], + [2, 4]); check(create([1, 2, 3, 4, 5], isError: (x) => x < 4, defaultValue: 42), (x) => true, [4, 5], [1, 2, 3]); @@ -46,8 +51,12 @@ void test(CreateStreamWithErrorsFunction create) { (x) => false, [], [1, 2, 3]); check( create([1, 2, 3, 4, 5], isError: (x) => x < 4, defaultValue: 42), - (x) => x > 2, [4, 5], [1, 2, 3]); + (x) => x > 2, + [4, 5], + [1, 2, 3]); check( create([1, 2, 3, 4, 5], isError: (x) => x > 2, defaultValue: 42), - (x) => x < 3, [1, 2], [3, 4, 5]); + (x) => x < 3, + [1, 2], + [3, 4, 5]); } diff --git a/LibTest/async/Stream/takeWhile_A01_t03.test.dart b/LibTest/async/Stream/takeWhile_A01_t03.test.dart index a7d0412ca8..97b22f7a97 100644 --- a/LibTest/async/Stream/takeWhile_A01_t03.test.dart +++ b/LibTest/async/Stream/takeWhile_A01_t03.test.dart @@ -14,26 +14,23 @@ /// @author a.semenov@unipro.ru library takeWhile_A01_t03; + import "dart:async"; import "../../../Utils/expect.dart"; -void check(Stream s, bool test(T element), - Object expectedError, List expected) { +void check( + Stream s, bool test(T element), Object expectedError, List expected) { AsyncExpect.events(expected, [expectedError], s.takeWhile(test)); } void test(CreateStreamFunction create) { AsyncExpect.data([], create([]).takeWhile((e) => throw "a")); check(create([1, 2, 3]), (e) => throw "b", "b", []); - check( - create([-1, -2, -3, 1, 2, 3]), - (element) { - if (element > 0) { - throw "c"; - }; - return true; - }, - "c", - [-1, -2, -3] - ); + check(create([-1, -2, -3, 1, 2, 3]), (element) { + if (element > 0) { + throw "c"; + } + ; + return true; + }, "c", [-1, -2, -3]); } diff --git a/LibTest/async/Stream/takeWhile_A02_t01.test.dart b/LibTest/async/Stream/takeWhile_A02_t01.test.dart index dec4519817..0a9ace58f5 100644 --- a/LibTest/async/Stream/takeWhile_A02_t01.test.dart +++ b/LibTest/async/Stream/takeWhile_A02_t01.test.dart @@ -9,6 +9,7 @@ /// @author a.semenov@unipro.ru library takeWhile_A02_t01; + import "dart:async"; import "../../../Utils/expect.dart"; diff --git a/LibTest/async/Stream/take_A01_t01.test.dart b/LibTest/async/Stream/take_A01_t01.test.dart index 2a155ba722..4aa0fcd11c 100644 --- a/LibTest/async/Stream/take_A01_t01.test.dart +++ b/LibTest/async/Stream/take_A01_t01.test.dart @@ -12,6 +12,7 @@ /// @author kaigorodov library take_A01_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { @@ -23,10 +24,21 @@ void test(CreateStreamFunction create) { AsyncExpect.data([null], create([null]).take(1)); AsyncExpect.data([null], create([null]).take(2)); - AsyncExpect.data([], create([1,2,3]).take(0)); - AsyncExpect.data([1], create([1,2,3]).take(1)); - AsyncExpect.data([1,2], create([1,2,3]).take(2)); - AsyncExpect.data([1,2,3], create([1,2,3]).take(12)); + AsyncExpect.data([], create([1, 2, 3]).take(0)); + AsyncExpect.data([1], create([1, 2, 3]).take(1)); + AsyncExpect.data([1, 2], create([1, 2, 3]).take(2)); + AsyncExpect.data([1, 2, 3], create([1, 2, 3]).take(12)); - AsyncExpect.data([[], [[]]], create([[], [[]], [[[]]]]).take(2)); + AsyncExpect.data( + [ + [], + [[]] + ], + create([ + [], + [[]], + [ + [[]] + ] + ]).take(2)); } diff --git a/LibTest/async/Stream/take_A01_t02.test.dart b/LibTest/async/Stream/take_A01_t02.test.dart index 16d7a48f08..64e1176b0a 100644 --- a/LibTest/async/Stream/take_A01_t02.test.dart +++ b/LibTest/async/Stream/take_A01_t02.test.dart @@ -18,26 +18,32 @@ library take_A01_t02; import "dart:async"; import "../../../Utils/expect.dart"; -void check( +void check( Stream s, int count, List expectedData, List expectedErrors) { AsyncExpect.events(expectedData, expectedErrors, s.take(count)); } void test(CreateStreamWithErrorsFunction create) { check(create([1, 2, 3], isError: (_) => true, defaultValue: 42), 0, [], []); - check(create([1, 2, 3], isError: (_) => true, defaultValue: 42), - 1, [], [1, 2, 3]); - check(create([1, 2, 3], isError: (_) => true, defaultValue: 42), - 10, [], [1, 2, 3]); + check(create([1, 2, 3], isError: (_) => true, defaultValue: 42), 1, [], + [1, 2, 3]); + check(create([1, 2, 3], isError: (_) => true, defaultValue: 42), 10, [], + [1, 2, 3]); check(create([1, 2, 3, 4, 5], isError: (x) => x.isOdd, defaultValue: 42), 10, [2, 4], [1, 3, 5]); check(create([1, 2, 3, 4, 5], isError: (x) => x.isOdd, defaultValue: 42), 2, [2, 4], [1, 3]); - check(create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), - 1, [1], []); - check(create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), - 2, [1, 3], [2]); + check( + create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), + 1, + [1], + []); + check( + create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), + 2, + [1, 3], + [2]); check(create([1, 2, 3, 4, 5], isError: (x) => x < 4, defaultValue: 42), 1, [4], [1, 2, 3]); diff --git a/LibTest/async/Stream/take_A01_t03.dart b/LibTest/async/Stream/take_A01_t03.dart index 6571a99c3a..1c31302d98 100644 --- a/LibTest/async/Stream/take_A01_t03.dart +++ b/LibTest/async/Stream/take_A01_t03.dart @@ -23,15 +23,11 @@ void main() { Stream s = new Stream.fromIterable(it).map((x) => throw new ArgumentError(x)); Stream t = s.take(takeCount); asyncStart(); - t.listen( - (value) { - Expect.fail("onData call not expected"); - }, - onError: (error) { - Expect.isTrue(error is ArgumentError); - }, - onDone: () { - asyncEnd(); - } - ); + t.listen((value) { + Expect.fail("onData call not expected"); + }, onError: (error) { + Expect.isTrue(error is ArgumentError); + }, onDone: () { + asyncEnd(); + }); } diff --git a/LibTest/async/Stream/take_A02_t01.test.dart b/LibTest/async/Stream/take_A02_t01.test.dart index 6869ebd744..68f9bce384 100644 --- a/LibTest/async/Stream/take_A02_t01.test.dart +++ b/LibTest/async/Stream/take_A02_t01.test.dart @@ -9,6 +9,7 @@ /// @author a.semenov@unipro.ru library take_A02_t01; + import "dart:async"; import "../../../Utils/expect.dart"; diff --git a/LibTest/async/Stream/timeout_A01_t01.test.dart b/LibTest/async/Stream/timeout_A01_t01.test.dart index 14e5ee95e2..831aa490e2 100644 --- a/LibTest/async/Stream/timeout_A01_t01.test.dart +++ b/LibTest/async/Stream/timeout_A01_t01.test.dart @@ -11,9 +11,10 @@ /// @author ngl@unipro.ru library timeout_A01_t01; + import "../../../Utils/expect.dart"; -const Duration _10DAYS = const Duration(days:10); +const Duration _10DAYS = const Duration(days: 10); void test(CreateStreamFunction create) { AsyncExpect.data([], create([]).timeout(_10DAYS)); @@ -21,8 +22,6 @@ void test(CreateStreamFunction create) { List data = new List.generate(10, (int index) => index * 2); AsyncExpect.data(data, create(data).timeout(_10DAYS)); - AsyncExpect.data( - ["a", "b", "c", 3.14, 100], - create(["a", "b", "c", 3.14, 100]).timeout(_10DAYS) - ); + AsyncExpect.data(["a", "b", "c", 3.14, 100], + create(["a", "b", "c", 3.14, 100]).timeout(_10DAYS)); } diff --git a/LibTest/async/Stream/timeout_A01_t02.test.dart b/LibTest/async/Stream/timeout_A01_t02.test.dart index 91fc53b0de..46fde27d71 100644 --- a/LibTest/async/Stream/timeout_A01_t02.test.dart +++ b/LibTest/async/Stream/timeout_A01_t02.test.dart @@ -24,8 +24,10 @@ void check(Stream s, List expectedData, List expectedErrors) { void test(CreateStreamWithErrorsFunction create) { check(create([1, 2, 3, 4, 5], isError: (x) => true, defaultValue: 42), [], [1, 2, 3, 4, 5]); - check(create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), - [1, 3, 5], [2, 4]); + check( + create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), + [1, 3, 5], + [2, 4]); check(create([1, 2, 3, 4, 5], isError: (x) => x.isOdd, defaultValue: 42), [2, 4], [1, 3, 5]); } diff --git a/LibTest/async/Stream/timeout_A02_t01.test.dart b/LibTest/async/Stream/timeout_A02_t01.test.dart index 06170b853d..85d225403a 100644 --- a/LibTest/async/Stream/timeout_A02_t01.test.dart +++ b/LibTest/async/Stream/timeout_A02_t01.test.dart @@ -15,16 +15,16 @@ /// @author a.semenov@unipro.ru library timeout_A02_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { int count = 0; Stream s1 = create(["a", "b", "c"]); - Stream s2 = s1.asyncMap((x) => new Future.delayed(durationInMilliseconds(100), () => x)); - Stream s3 = s2.timeout( - durationInMilliseconds(10), - onTimeout: (EventSink sink) => sink.add(count++) - ); + Stream s2 = s1.asyncMap( + (x) => new Future.delayed(durationInMilliseconds(100), () => x)); + Stream s3 = s2.timeout(durationInMilliseconds(10), + onTimeout: (EventSink sink) => sink.add(count++)); AsyncExpect.data([0, "a", 1, "b", 2, "c"], s3); } diff --git a/LibTest/async/Stream/timeout_A02_t02.test.dart b/LibTest/async/Stream/timeout_A02_t02.test.dart index 22a1752cd5..cc21bacf4e 100644 --- a/LibTest/async/Stream/timeout_A02_t02.test.dart +++ b/LibTest/async/Stream/timeout_A02_t02.test.dart @@ -14,41 +14,32 @@ /// @author a.semenov@unipro.ru library timeout_A02_t02; + import "dart:async"; import "../../../Utils/expect.dart"; void check(Stream s, List expectedEvents) { int count = 0; // delay for 100 ms and throw error if element starts with '!' - Stream s2 = s.asyncMap( - (x) => new Future.delayed( - durationInMilliseconds(100), - () { - if (x is String && x.startsWith("!")){ - throw x; - } - return x; - } - ) - ); - Stream s3 = s2.timeout( - durationInMilliseconds(10), - onTimeout: (EventSink sink) => sink.add(count++) - ); + Stream s2 = + s.asyncMap((x) => new Future.delayed(durationInMilliseconds(100), () { + if (x is String && x.startsWith("!")) { + throw x; + } + return x; + })); + Stream s3 = s2.timeout(durationInMilliseconds(10), + onTimeout: (EventSink sink) => sink.add(count++)); List actualEvents = []; asyncStart(); - s3.listen( - (event) { - actualEvents.add(event); - }, - onError: (error) { - actualEvents.add("+"+error.toString()); - }, - onDone: () { - Expect.listEquals(expectedEvents, actualEvents); - asyncEnd(); - } - ); + s3.listen((event) { + actualEvents.add(event); + }, onError: (error) { + actualEvents.add("+" + error.toString()); + }, onDone: () { + Expect.listEquals(expectedEvents, actualEvents); + asyncEnd(); + }); } void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/timeout_A03_t01.test.dart b/LibTest/async/Stream/timeout_A03_t01.test.dart index 182fa85072..240f0a3c17 100644 --- a/LibTest/async/Stream/timeout_A03_t01.test.dart +++ b/LibTest/async/Stream/timeout_A03_t01.test.dart @@ -14,27 +14,25 @@ /// @author ngl@unipro.ru library timeout_A03_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { int count = 0; Stream s1 = create(["a", "b", "c"]); - Stream s2 = s1.asyncMap((x) => new Future.delayed(durationInMilliseconds(100), () => x)); + Stream s2 = s1.asyncMap( + (x) => new Future.delayed(durationInMilliseconds(100), () => x)); Stream s3 = s2.timeout(durationInMilliseconds(10)); List actual = []; asyncStart(); - s3.listen( - (event) { - actual.add(event); - }, - onError: (error) { - Expect.isTrue(error is TimeoutException); - actual.add(count++); - }, - onDone: () { - Expect.listEquals([0, "a", 1, "b", 2, "c"], actual); - asyncEnd(); - } - ); + s3.listen((event) { + actual.add(event); + }, onError: (error) { + Expect.isTrue(error is TimeoutException); + actual.add(count++); + }, onDone: () { + Expect.listEquals([0, "a", 1, "b", 2, "c"], actual); + asyncEnd(); + }); } diff --git a/LibTest/async/Stream/timeout_A03_t02.test.dart b/LibTest/async/Stream/timeout_A03_t02.test.dart index e3449826b3..f55df01660 100644 --- a/LibTest/async/Stream/timeout_A03_t02.test.dart +++ b/LibTest/async/Stream/timeout_A03_t02.test.dart @@ -15,47 +15,41 @@ /// @author a.semenov@unipro.ru library timeout_A03_t02; + import "dart:async"; import "../../../Utils/expect.dart"; void check(Stream s, List expectedEvents) { int count = 0; // delay for 100 ms and throw error if element starts with '!' - Stream s2 = s.asyncMap( - (x) => new Future.delayed( - durationInMilliseconds(100), - () { - if (x is String && x.startsWith("!")){ - throw x; - } - return x; - } - ) - ); + Stream s2 = + s.asyncMap((x) => new Future.delayed(durationInMilliseconds(100), () { + if (x is String && x.startsWith("!")) { + throw x; + } + return x; + })); Stream s3 = s2.timeout(durationInMilliseconds(10)); List actualEvents = []; asyncStart(); - s3.listen( - (event) { - actualEvents.add(event); - }, - onError: (error) { - if (error is TimeoutException){ - actualEvents.add("+TE"+count.toString()); - count++; - } else { - actualEvents.add("+" + error.toString()); - } - }, - onDone: () { - Expect.listEquals(expectedEvents, actualEvents); - asyncEnd(); + s3.listen((event) { + actualEvents.add(event); + }, onError: (error) { + if (error is TimeoutException) { + actualEvents.add("+TE" + count.toString()); + count++; + } else { + actualEvents.add("+" + error.toString()); } - ); + }, onDone: () { + Expect.listEquals(expectedEvents, actualEvents); + asyncEnd(); + }); } void test(CreateStreamFunction create) { - check(create(["!a", "!b", "!c"]), ["+TE0", "+!a", "+TE1", "+!b", "+TE2", "+!c"]); + check(create(["!a", "!b", "!c"]), + ["+TE0", "+!a", "+TE1", "+!b", "+TE2", "+!c"]); check(create(["!a", "b", "!c"]), ["+TE0", "+!a", "+TE1", "b", "+TE2", "+!c"]); check(create(["a", "b", "!c"]), ["+TE0", "a", "+TE1", "b", "+TE2", "+!c"]); check(create(["a", "!b", "c"]), ["+TE0", "a", "+TE1", "+!b", "+TE2", "c"]); diff --git a/LibTest/async/Stream/timeout_A04_t01.dart b/LibTest/async/Stream/timeout_A04_t01.dart index c26a03b74e..f66df89545 100644 --- a/LibTest/async/Stream/timeout_A04_t01.dart +++ b/LibTest/async/Stream/timeout_A04_t01.dart @@ -30,11 +30,10 @@ void ontimeout(EventSink sink) { } main() { - Stream s1 = new Stream.fromIterable( - [cl[0].future, cl[1].future, cl[2].future]); + Stream s1 = + new Stream.fromIterable([cl[0].future, cl[1].future, cl[2].future]); Stream s2 = s1.asyncMap((var event) => event); - Stream s3 = s2.timeout(new Duration(microseconds: 1), - onTimeout: ontimeout); + Stream s3 = s2.timeout(new Duration(microseconds: 1), onTimeout: ontimeout); asyncStart(); s3.listen((var event) { diff --git a/LibTest/async/Stream/timeout_A05_t01.test.dart b/LibTest/async/Stream/timeout_A05_t01.test.dart index 0d11debad6..53062a1f8d 100644 --- a/LibTest/async/Stream/timeout_A05_t01.test.dart +++ b/LibTest/async/Stream/timeout_A05_t01.test.dart @@ -10,17 +10,19 @@ /// @author a.semenov@unipro.ru library timeout_A05_t01; + import "dart:async"; import "../../../Utils/expect.dart"; void check(Stream s, T timeoutValue) { - Expect.equals(s.isBroadcast, s.timeout(durationInMilliseconds(10)).isBroadcast); - Expect.equals(s.isBroadcast, - s.timeout( - durationInMilliseconds(10), - onTimeout:(EventSink sink) => sink.add(timeoutValue) - ).isBroadcast - ); + Expect.equals( + s.isBroadcast, s.timeout(durationInMilliseconds(10)).isBroadcast); + Expect.equals( + s.isBroadcast, + s + .timeout(durationInMilliseconds(10), + onTimeout: (EventSink sink) => sink.add(timeoutValue)) + .isBroadcast); } void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/toList_A01_t01.test.dart b/LibTest/async/Stream/toList_A01_t01.test.dart index 5ffc12178b..d7005b07f3 100644 --- a/LibTest/async/Stream/toList_A01_t01.test.dart +++ b/LibTest/async/Stream/toList_A01_t01.test.dart @@ -9,15 +9,28 @@ /// @author kaigorodov library toList_A01_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { AsyncExpect.value([], create([]).toList()); - AsyncExpect.value( - [-1, -2, -3, 1, 2, 3, -1, -2, -3], - create([-1, -2, -3, 1, 2, 3, -1, -2, -3]).toList() - ); + AsyncExpect.value([-1, -2, -3, 1, 2, 3, -1, -2, -3], + create([-1, -2, -3, 1, 2, 3, -1, -2, -3]).toList()); AsyncExpect.value([1, 2, 3], create([1, 2, 3]).toList()); - AsyncExpect.value([[], [[]], [[[]]]], create([[], [[]], [[[]]]]).toList()); + AsyncExpect.value( + [ + [], + [[]], + [ + [[]] + ] + ], + create([ + [], + [[]], + [ + [[]] + ] + ]).toList()); AsyncExpect.value(["1", 2, null], create(["1", 2, null]).toList()); } diff --git a/LibTest/async/Stream/toSet_A01_t01.test.dart b/LibTest/async/Stream/toSet_A01_t01.test.dart index ed4ee062fb..1d5afefe02 100644 --- a/LibTest/async/Stream/toSet_A01_t01.test.dart +++ b/LibTest/async/Stream/toSet_A01_t01.test.dart @@ -8,19 +8,26 @@ /// @author kaigorodov library toSet_A01_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { AsyncExpect.value(new Set.from([]), create([]).toSet()); AsyncExpect.value(new Set.from([1, 2, 3]), create([1, 2, 3]).toSet()); - Set data = new Set.from([[], [[]], [[[]]]]); + Set data = new Set.from([ + [], + [[]], + [ + [[]] + ] + ]); AsyncExpect.value(data, create(data).toSet()); - AsyncExpect.value(new Set.from(["1", 2, null]), create(["1", 2, null]).toSet()); + AsyncExpect.value( + new Set.from(["1", 2, null]), create(["1", 2, null]).toSet()); - AsyncExpect.value(new Set.from([1]), create([1,1,1]).toSet()); - AsyncExpect.value(new Set.from([1,2,3]), create([1,2,3,1,2,3]).toSet()); + AsyncExpect.value(new Set.from([1]), create([1, 1, 1]).toSet()); AsyncExpect.value( - new Set.from([-1, -2, -3, 1, 2, 3]), - create([-1, -2, -3, 1, 2, 3, -1, -2, -3]).toSet() - ); + new Set.from([1, 2, 3]), create([1, 2, 3, 1, 2, 3]).toSet()); + AsyncExpect.value(new Set.from([-1, -2, -3, 1, 2, 3]), + create([-1, -2, -3, 1, 2, 3, -1, -2, -3]).toSet()); } diff --git a/LibTest/async/Stream/transform_A01_t01.test.dart b/LibTest/async/Stream/transform_A01_t01.test.dart index c6938dd8d4..e3c225b910 100644 --- a/LibTest/async/Stream/transform_A01_t01.test.dart +++ b/LibTest/async/Stream/transform_A01_t01.test.dart @@ -30,8 +30,8 @@ void check(Stream s, StreamTransformer transformer, } void test(CreateStreamWithErrorsFunction create) { - check(create([1, 2, 3, 4, 5], defaultValue: 42), - passThrough, [1, 2, 3, 4, 5], []); + check(create([1, 2, 3, 4, 5], defaultValue: 42), passThrough, [1, 2, 3, 4, 5], + []); check(create([1, 2, 3, 4, 5], isError: (x) => x.isOdd, defaultValue: 42), passThrough, [2, 4], [1, 3, 5]); check(create([1, 2, 3, 4, 5], isError: (x) => true, defaultValue: 42), diff --git a/LibTest/async/Stream/transform_A01_t02.test.dart b/LibTest/async/Stream/transform_A01_t02.test.dart index abcd5b356f..569b9f7b6d 100644 --- a/LibTest/async/Stream/transform_A01_t02.test.dart +++ b/LibTest/async/Stream/transform_A01_t02.test.dart @@ -9,6 +9,7 @@ /// @author ilya library transform_A01_t02; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -17,14 +18,13 @@ List expected = [1, 2, 3, 6, 5, 10]; // transform: skip evens, produce number and its double StreamTransformer createMyTransformer() { - return new StreamTransformer.fromHandlers ( - handleData: (int event, EventSink sink) { - if (event.isOdd) { - sink.add(event); - sink.add(event * 2); - } + return new StreamTransformer.fromHandlers( + handleData: (int event, EventSink sink) { + if (event.isOdd) { + sink.add(event); + sink.add(event * 2); } - ); + }); } void test(CreateStreamFunction create) { diff --git a/LibTest/async/Stream/where_A01_t01.test.dart b/LibTest/async/Stream/where_A01_t01.test.dart index fc993f2975..1067649178 100644 --- a/LibTest/async/Stream/where_A01_t01.test.dart +++ b/LibTest/async/Stream/where_A01_t01.test.dart @@ -11,18 +11,21 @@ /// @author kaigorodov library where_A01_t01; + import "../../../Utils/expect.dart"; void test(CreateStreamFunction create) { AsyncExpect.data([], create([]).where((e) => true)); AsyncExpect.data([], create([]).where((e) => false)); - AsyncExpect.data([null], create([1, 2, 3, null]).where((int? e) => e == null)); + AsyncExpect.data( + [null], create([1, 2, 3, null]).where((int? e) => e == null)); AsyncExpect.data([3], create([1, 2, 3]).where((int e) => e > 2)); AsyncExpect.data( [30], - create(new Iterable.generate(10, (int i) => i * 5)).where((int e) => e == 30) - ); - AsyncExpect.data([1,3,5], create([1, 2, 3, 4, 5]).where((int e) => e.isOdd)); - AsyncExpect.data([2,4], create([1, 2, 3, 4, 5]).where((int e) => e.isEven)); + create(new Iterable.generate(10, (int i) => i * 5)) + .where((int e) => e == 30)); + AsyncExpect.data( + [1, 3, 5], create([1, 2, 3, 4, 5]).where((int e) => e.isOdd)); + AsyncExpect.data([2, 4], create([1, 2, 3, 4, 5]).where((int e) => e.isEven)); } diff --git a/LibTest/async/Stream/where_A01_t02.test.dart b/LibTest/async/Stream/where_A01_t02.test.dart index 0f0ed2feb9..a35d9176fe 100644 --- a/LibTest/async/Stream/where_A01_t02.test.dart +++ b/LibTest/async/Stream/where_A01_t02.test.dart @@ -23,14 +23,24 @@ void check(Stream s, bool test(T event), List expectedData, void test(CreateStreamWithErrorsFunction create) { check(create([1, 2, 3, 4, 5], isError: (x) => true, defaultValue: 42), (e) => true, [], [1, 2, 3, 4, 5]); - check(create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), - (e) => true, [1, 3, 5], [2, 4]); + check( + create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), + (e) => true, + [1, 3, 5], + [2, 4]); check( create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), - (e) => e > 1, [3, 5], [2, 4]); - check(create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), - (e) => false, [], [2, 4]); + (e) => e > 1, + [3, 5], + [2, 4]); + check( + create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), + (e) => false, + [], + [2, 4]); check( create([1, 2, 3, 4, 5], isError: (x) => x.isEven, defaultValue: 42), - (e) => throw e, [], [1, 2, 3, 4, 5]); + (e) => throw e, + [], + [1, 2, 3, 4, 5]); } diff --git a/LibTest/async/StreamConsumer/StreamConsumer_A01_t01.test.dart b/LibTest/async/StreamConsumer/StreamConsumer_A01_t01.test.dart index 02fb41c0d1..8e2b7f5325 100644 --- a/LibTest/async/StreamConsumer/StreamConsumer_A01_t01.test.dart +++ b/LibTest/async/StreamConsumer/StreamConsumer_A01_t01.test.dart @@ -8,6 +8,7 @@ /// @author ngl@unipro.ru library StreamConsumer_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -16,4 +17,3 @@ test(StreamConsumer create()) { Expect.isTrue(sc is StreamConsumer); Expect.runtimeIsType(sc); } - diff --git a/LibTest/async/StreamConsumer/addStream_A01_t01.test.dart b/LibTest/async/StreamConsumer/addStream_A01_t01.test.dart index 5727d9086b..0ad9ebc7d5 100644 --- a/LibTest/async/StreamConsumer/addStream_A01_t01.test.dart +++ b/LibTest/async/StreamConsumer/addStream_A01_t01.test.dart @@ -14,6 +14,7 @@ /// @author ngl@unipro.ru library addStream_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -26,11 +27,9 @@ test(StreamConsumer create()) { sc.stream.listen((value) { Expect.equals(values[i++], value); - }, - onError: (error) { + }, onError: (error) { Expect.fail("Unexpected error: $error"); - }, - onDone: () { + }, onDone: () { asyncEnd(); }); @@ -42,4 +41,3 @@ test(StreamConsumer create()) { }); } } - diff --git a/LibTest/async/StreamConsumer/addStream_A02_t01.test.dart b/LibTest/async/StreamConsumer/addStream_A02_t01.test.dart index 047ce6ebe7..c1c381cb21 100644 --- a/LibTest/async/StreamConsumer/addStream_A02_t01.test.dart +++ b/LibTest/async/StreamConsumer/addStream_A02_t01.test.dart @@ -13,6 +13,7 @@ /// @author ngl@unipro.ru library addStream_A02_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -28,13 +29,9 @@ test(StreamConsumer create()) { if (i == 3) { asyncEnd(); } - }, - onError: (error) { + }, onError: (error) { Expect.fail("Unexpected error: $error"); - - }, - onDone: () { - }); + }, onDone: () {}); asyncStart(); sc1.addStream(new Stream.fromIterable([1, 2, 3])); @@ -50,4 +47,3 @@ test(StreamConsumer create()) { } } } - diff --git a/LibTest/async/StreamConsumer/all_tests.lib.dart b/LibTest/async/StreamConsumer/all_tests.lib.dart index 60ce6d6a8c..19139fd5fb 100644 --- a/LibTest/async/StreamConsumer/all_tests.lib.dart +++ b/LibTest/async/StreamConsumer/all_tests.lib.dart @@ -10,6 +10,7 @@ /// @author ngl@unipro.ru library all_tests_streamconsumer; + import "dart:async"; import "../../../Utils/expect.dart"; diff --git a/LibTest/async/StreamConsumer/close_A01_t01.test.dart b/LibTest/async/StreamConsumer/close_A01_t01.test.dart index 9070488169..aaa4fa53f7 100644 --- a/LibTest/async/StreamConsumer/close_A01_t01.test.dart +++ b/LibTest/async/StreamConsumer/close_A01_t01.test.dart @@ -10,6 +10,7 @@ /// @author ngl@unipro.ru library close_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -22,11 +23,9 @@ test(StreamConsumer create()) { sc.stream.listen((value) { Expect.equals(values[i++], value); - }, - onError: (error) { + }, onError: (error) { Expect.fail("Unexpected error: $error"); - }, - onDone: () { + }, onDone: () { Expect.equals(3, i); asyncEnd(); }); @@ -41,7 +40,5 @@ test(StreamConsumer create()) { } }); }); - } } - diff --git a/LibTest/async/StreamConsumer/equality_operator_A01_t01.test.dart b/LibTest/async/StreamConsumer/equality_operator_A01_t01.test.dart index ad4dfa65c5..ad6fb8343d 100644 --- a/LibTest/async/StreamConsumer/equality_operator_A01_t01.test.dart +++ b/LibTest/async/StreamConsumer/equality_operator_A01_t01.test.dart @@ -10,6 +10,7 @@ /// @author ngl@unipro.ru library equality_operator_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -21,4 +22,3 @@ test(StreamConsumer create()) { Expect.isFalse(sc1 == sc2); Expect.isTrue(sc1 == sc3); } - diff --git a/LibTest/async/StreamConsumer/hashCode_A01_t01.test.dart b/LibTest/async/StreamConsumer/hashCode_A01_t01.test.dart index 64bf72bc79..ea6a6bf790 100644 --- a/LibTest/async/StreamConsumer/hashCode_A01_t01.test.dart +++ b/LibTest/async/StreamConsumer/hashCode_A01_t01.test.dart @@ -14,6 +14,7 @@ /// @author ngl@unipro.ru library hashCode_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -33,4 +34,3 @@ test(StreamConsumer create()) { Expect.isFalse(sc1.hashCode == sc3.hashCode); } } - diff --git a/LibTest/async/StreamConsumer/noSuchMethodError_A01_t01.test.dart b/LibTest/async/StreamConsumer/noSuchMethodError_A01_t01.test.dart index 0df8b3effe..e69cc373eb 100644 --- a/LibTest/async/StreamConsumer/noSuchMethodError_A01_t01.test.dart +++ b/LibTest/async/StreamConsumer/noSuchMethodError_A01_t01.test.dart @@ -11,6 +11,7 @@ /// @author ngl@unipro.ru library noSuchMethodError_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -18,14 +19,17 @@ test(StreamConsumer create()) { dynamic cs1 = create(); try { - cs1.m1(); /// static type warning + cs1.m1(); + + /// static type warning } catch (e) { Expect.isTrue(e is NoSuchMethodError); } try { - cs1.abc; /// static type warning + cs1.abc; + + /// static type warning } catch (e) { Expect.isTrue(e is NoSuchMethodError); } } - diff --git a/LibTest/async/StreamConsumer/runtimeType_A01_t01.test.dart b/LibTest/async/StreamConsumer/runtimeType_A01_t01.test.dart index 3dd1f8dd8d..fc308283fc 100644 --- a/LibTest/async/StreamConsumer/runtimeType_A01_t01.test.dart +++ b/LibTest/async/StreamConsumer/runtimeType_A01_t01.test.dart @@ -9,6 +9,7 @@ /// @author ngl@unipro.ru library runtimeType_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -24,4 +25,3 @@ test(StreamConsumer create()) { Expect.equals(sc1.runtimeType, sc2.runtimeType); Expect.notEquals(sc1.runtimeType, o.runtimeType); } - diff --git a/LibTest/async/StreamConsumer/toString_A01_t01.test.dart b/LibTest/async/StreamConsumer/toString_A01_t01.test.dart index cd445ded70..98c938a90b 100644 --- a/LibTest/async/StreamConsumer/toString_A01_t01.test.dart +++ b/LibTest/async/StreamConsumer/toString_A01_t01.test.dart @@ -10,6 +10,7 @@ /// @author ngl@unipro.ru library toString_A01_t01; + import "dart:async"; import "../../../Utils/expect.dart"; @@ -24,4 +25,3 @@ test(StreamConsumer create()) { Expect.notEquals(sc1, sc2); Expect.equals(sc1.toString(), sc2.toString()); } - diff --git a/LibTest/async/StreamController/StreamController.broadcast_A01_t01.dart b/LibTest/async/StreamController/StreamController.broadcast_A01_t01.dart index d9b19a547b..3877c43006 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_A01_t01.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_A01_t01.dart @@ -24,7 +24,9 @@ check(List events0) { Stream s = controller.stream; List events1 = new List.empty(growable: true); - StreamSubscription ss1 = s.listen((event) {events1.add(event);}); + StreamSubscription ss1 = s.listen((event) { + events1.add(event); + }); asyncStart(); ss1.onDone(() { Expect.listEquals(events0, events1); @@ -32,7 +34,9 @@ check(List events0) { }); List events2 = new List.empty(growable: true); - StreamSubscription ss2 = s.listen((event) {events2.add(event);}); + StreamSubscription ss2 = s.listen((event) { + events2.add(event); + }); asyncStart(); ss2.onDone(() { Expect.listEquals(events0, events2); diff --git a/LibTest/async/StreamController/StreamController.broadcast_A01_t03.dart b/LibTest/async/StreamController/StreamController.broadcast_A01_t03.dart index a64bcf6211..4464c71fd6 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_A01_t03.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_A01_t03.dart @@ -28,27 +28,22 @@ check(List events) { asyncStart(2); List events1 = [], errors1 = []; - s.listen( - (event) => events1.add(event), - onError: (error) => errors1.add(error), - onDone: () { - Expect.listEquals(expectedData, events1); - Expect.listEquals(expectedErrors, errors1); - asyncEnd(); - } - ); - + s.listen((event) => events1.add(event), + onError: (error) => errors1.add(error), + onDone: () { + Expect.listEquals(expectedData, events1); + Expect.listEquals(expectedErrors, errors1); + asyncEnd(); + }); List events2 = [], errors2 = []; - s.listen( - (event) => events2.add(event), + s.listen((event) => events2.add(event), onError: (error) => errors2.add(error), onDone: () { Expect.listEquals(expectedData, events2); Expect.listEquals(expectedErrors, errors2); asyncEnd(); - } - ); + }); for (var event in events) { if (event is num && event < 0) { diff --git a/LibTest/async/StreamController/StreamController.broadcast_A03_t01.dart b/LibTest/async/StreamController/StreamController.broadcast_A03_t01.dart index 1292190fe3..fbd2e8a544 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_A03_t01.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_A03_t01.dart @@ -20,13 +20,10 @@ main() { controller.add("event"); asyncStart(); List receivedData = []; - controller.stream.listen( - (data) => receivedData.add(data), - onDone: () { - Expect.listEquals(["published", "event"], receivedData); - asyncEnd(); - } - ); + controller.stream.listen((data) => receivedData.add(data), onDone: () { + Expect.listEquals(["published", "event"], receivedData); + asyncEnd(); + }); controller.add("published"); controller.add("event"); controller.close(); diff --git a/LibTest/async/StreamController/StreamController.broadcast_A04_t01.dart b/LibTest/async/StreamController/StreamController.broadcast_A04_t01.dart index d7a924dcc6..b20acd8ccd 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_A04_t01.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_A04_t01.dart @@ -20,10 +20,14 @@ main() { Stream stream = controller.stream; bool event1seen = false; - StreamSubscription sub1 = stream.listen((event) {event1seen = true;}); + StreamSubscription sub1 = stream.listen((event) { + event1seen = true; + }); sub1.pause(); bool event2seen = false; - StreamSubscription sub2 = stream.listen((event) {event2seen = true;}); + StreamSubscription sub2 = stream.listen((event) { + event2seen = true; + }); controller.add(1); diff --git a/LibTest/async/StreamController/StreamController.broadcast_A05_t01.dart b/LibTest/async/StreamController/StreamController.broadcast_A05_t01.dart index 74a524d311..f4eb3102e4 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_A05_t01.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_A05_t01.dart @@ -19,7 +19,8 @@ import "dart:async"; import "../../../Utils/expect.dart"; main() { - StreamController streamController = new StreamController.broadcast(sync: true); + StreamController streamController = + new StreamController.broadcast(sync: true); Expect.isTrue(streamController is SynchronousStreamController); streamController.close(); } diff --git a/LibTest/async/StreamController/StreamController.broadcast_A06_t01.dart b/LibTest/async/StreamController/StreamController.broadcast_A06_t01.dart index 92063f4761..fbda214534 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_A06_t01.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_A06_t01.dart @@ -26,12 +26,10 @@ main() { Stream stream = controller.stream; bool onDataCalled = false; asyncStart(); - stream.listen( - (event) { - onDataCalled = true; - asyncEnd(); - } - ); + stream.listen((event) { + onDataCalled = true; + asyncEnd(); + }); controller.add(1); Expect.isFalse(onDataCalled); controller.close(); diff --git a/LibTest/async/StreamController/StreamController.broadcast_A06_t02.dart b/LibTest/async/StreamController/StreamController.broadcast_A06_t02.dart index 31ac4560fc..fcf2e48f0d 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_A06_t02.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_A06_t02.dart @@ -27,26 +27,20 @@ main() { int event1 = 0; asyncStart(2); - stream.listen( - (event){ - Expect.equals(event1, event); - event1++; - }, - onDone: () { - asyncEnd(); - } - ); + stream.listen((event) { + Expect.equals(event1, event); + event1++; + }, onDone: () { + asyncEnd(); + }); int event2 = 0; - stream.listen( - (event){ - Expect.equals(event2, event); - event2++; - }, - onDone: () { - asyncEnd(); - } - ); + stream.listen((event) { + Expect.equals(event2, event); + event2++; + }, onDone: () { + asyncEnd(); + }); for (int k = 0; k < 10; k++) { controller.add(k); diff --git a/LibTest/async/StreamController/StreamController.broadcast_A06_t03.dart b/LibTest/async/StreamController/StreamController.broadcast_A06_t03.dart index d5819a63c5..6e375f8a3a 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_A06_t03.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_A06_t03.dart @@ -27,29 +27,23 @@ main() { int event1 = 0; asyncStart(2); - stream.listen( - (event) { - Expect.equals(event1, event); - event1++; - }, - onDone: () { - asyncEnd(); - } - ); + stream.listen((event) { + Expect.equals(event1, event); + event1++; + }, onDone: () { + asyncEnd(); + }); for (int k = 0; k < 5; k++) { controller.add(k); } int event2 = 5; - stream.listen( - (event) { - Expect.equals(event2, event); - event2++; - }, - onDone: () { - asyncEnd(); - } - ); + stream.listen((event) { + Expect.equals(event2, event); + event2++; + }, onDone: () { + asyncEnd(); + }); for (int k = 5; k < 10; k++) { controller.add(k); } diff --git a/LibTest/async/StreamController/StreamController.broadcast_A07_t01.dart b/LibTest/async/StreamController/StreamController.broadcast_A07_t01.dart index 081e0b9621..53c86cde29 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_A07_t01.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_A07_t01.dart @@ -17,12 +17,10 @@ import "../../../Utils/expect.dart"; main() { bool onListenCalled = false; asyncStart(); - StreamController controller = new StreamController.broadcast( - onListen: () { - onListenCalled = true; - asyncEnd(); - } - ); + StreamController controller = new StreamController.broadcast(onListen: () { + onListenCalled = true; + asyncEnd(); + }); Expect.isFalse(onListenCalled); StreamSubscription subs = controller.stream.listen((event) {}); diff --git a/LibTest/async/StreamController/StreamController.broadcast_A07_t02.dart b/LibTest/async/StreamController/StreamController.broadcast_A07_t02.dart index 67231654fb..da715dc9f4 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_A07_t02.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_A07_t02.dart @@ -17,12 +17,10 @@ import "../../../Utils/expect.dart"; main() { bool onCancelCalled = false; asyncStart(); - StreamController controller = new StreamController.broadcast( - onCancel: () { - onCancelCalled = true; - asyncEnd(); - } - ); + StreamController controller = new StreamController.broadcast(onCancel: () { + onCancelCalled = true; + asyncEnd(); + }); Expect.isFalse(onCancelCalled); StreamSubscription subs = controller.stream.listen((event) {}); diff --git a/LibTest/async/StreamController/StreamController.broadcast_A07_t03.dart b/LibTest/async/StreamController/StreamController.broadcast_A07_t03.dart index 6afc388b2f..0f42026eb9 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_A07_t03.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_A07_t03.dart @@ -18,29 +18,23 @@ main() { int onCancelCallCount = 0; asyncStart(6); StreamController? controller; - controller = new StreamController.broadcast( - onCancel: () { - onCancelCallCount++; - Expect.equals(1, onCancelCallCount); - asyncEnd(); - controller?.close(); - } - ); - List subscriptions = new List.generate( - 5, - (_) => controller!.stream.listen((event) {}) - ); + controller = new StreamController.broadcast(onCancel: () { + onCancelCallCount++; + Expect.equals(1, onCancelCallCount); + asyncEnd(); + controller?.close(); + }); + List subscriptions = + new List.generate(5, (_) => controller!.stream.listen((event) {})); int i = 0, k = 0; new Timer.periodic(durationInMilliseconds(100), (Timer timer) { - new Future.value(subscriptions[i].cancel()).then( - (_) { - Expect.equals((++k < 5) ? 0 : 1, onCancelCallCount); - asyncEnd(); - } - ); + new Future.value(subscriptions[i].cancel()).then((_) { + Expect.equals((++k < 5) ? 0 : 1, onCancelCallCount); + asyncEnd(); + }); i++; - if (i==5) { + if (i == 5) { timer.cancel(); } }); diff --git a/LibTest/async/StreamController/StreamController.broadcast_A08_t01.dart b/LibTest/async/StreamController/StreamController.broadcast_A08_t01.dart index 86dd8b27dc..4a6da8c43c 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_A08_t01.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_A08_t01.dart @@ -19,27 +19,24 @@ main() { bool onCancelCalled = false; asyncStart(4); - StreamController controller = new StreamController.broadcast( - onListen: () { - onListenCalled = true; - asyncEnd(); - }, - onCancel: () { - onCancelCalled = true; - asyncEnd(); - } - ); + StreamController controller = new StreamController.broadcast(onListen: () { + onListenCalled = true; + asyncEnd(); + }, onCancel: () { + onCancelCalled = true; + asyncEnd(); + }); Stream stream = controller.stream; Expect.isFalse(onListenCalled); - StreamSubscription subs = stream.listen((event){}); + StreamSubscription subs = stream.listen((event) {}); Expect.isTrue(onListenCalled); subs.cancel(); Expect.isTrue(onCancelCalled); onListenCalled = false; - subs=stream.listen((event) {}); + subs = stream.listen((event) {}); Expect.isTrue(onListenCalled); controller.close(); diff --git a/LibTest/async/StreamController/StreamController.broadcast_A08_t02.dart b/LibTest/async/StreamController/StreamController.broadcast_A08_t02.dart index 24346c1926..ad7f98b596 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_A08_t02.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_A08_t02.dart @@ -21,7 +21,8 @@ List subscribe(StreamController controller, int count) { Future unsubscribe(List subscriptions, int count) { count--; - return new Future.delayed(durationInMilliseconds(50), () => subscriptions[count].cancel()) + return new Future.delayed( + durationInMilliseconds(50), () => subscriptions[count].cancel()) .then((_) { if (count > 0) { return unsubscribe(subscriptions, count); diff --git a/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A01_t01.dart b/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A01_t01.dart index 7edc2faf88..d6be4ba5c7 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A01_t01.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A01_t01.dart @@ -20,21 +20,18 @@ import "../Stream/allTests_A01.lib.dart"; Stream create(Iterable data, {bool isError(T element)?}) { StreamController? sc; - sc = new StreamController.broadcast( - onListen:() { - for (T e in data) { - if (isError != null && isError(e)) { - sc?.addError(e as Object); - } else { - sc?.add(e); - } + sc = new StreamController.broadcast(onListen: () { + for (T e in data) { + if (isError != null && isError(e)) { + sc?.addError(e as Object); + } else { + sc?.add(e); } - new Future(() => sc?.close()); - }, - onCancel: () { - sc?.close(); } - ); + new Future(() => sc?.close()); + }, onCancel: () { + sc?.close(); + }); return sc.stream; } diff --git a/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A01_t02.dart b/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A01_t02.dart index 6bdf08cb45..932f566009 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A01_t02.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A01_t02.dart @@ -18,24 +18,21 @@ import "dart:async"; import "../Stream/allTests_A02.lib.dart"; -Stream create( - Iterable data, {bool isError(T element)?, T? defaultValue}) { +Stream create(Iterable data, + {bool isError(T element)?, T? defaultValue}) { StreamController? sc; - sc = new StreamController.broadcast( - onListen:() { - for (T e in data) { - if (isError != null && isError(e)) { - sc?.addError(e as Object); - } else { - sc?.add(e); - } + sc = new StreamController.broadcast(onListen: () { + for (T e in data) { + if (isError != null && isError(e)) { + sc?.addError(e as Object); + } else { + sc?.add(e); } - new Future(() => sc?.close()); - }, - onCancel: () { - sc?.close(); } - ); + new Future(() => sc?.close()); + }, onCancel: () { + sc?.close(); + }); return sc.stream; } diff --git a/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A01_t03.dart b/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A01_t03.dart index db1f2953f6..c74f5e25db 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A01_t03.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A01_t03.dart @@ -21,21 +21,18 @@ import "../Stream/allTests_A03.lib.dart"; Stream create(Iterable data, {bool isError(T element)?}) { StreamController? sc; - sc = new StreamController.broadcast( - onListen:() { - for (T e in data) { - if (isError != null && isError(e)) { - sc?.addError(e as Object); - } else { - sc?.add(e); - } + sc = new StreamController.broadcast(onListen: () { + for (T e in data) { + if (isError != null && isError(e)) { + sc?.addError(e as Object); + } else { + sc?.add(e); } - new Future(() => sc?.close()); - }, - onCancel: () { - sc?.close(); } - ); + new Future(() => sc?.close()); + }, onCancel: () { + sc?.close(); + }); return sc.stream; } diff --git a/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A02_t01.dart b/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A02_t01.dart index f505ae3dff..c5bf44452f 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A02_t01.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A02_t01.dart @@ -21,25 +21,24 @@ import "../Stream/allTests_A01.lib.dart"; Stream create(Iterable data, {bool isError(T element)?}) { StreamController? sc; sc = new StreamController.broadcast( - sync: true, - onListen: () { - new Future(() { - for (T e in data) { - if (sc!.isClosed){ - break; + sync: true, + onListen: () { + new Future(() { + for (T e in data) { + if (sc!.isClosed) { + break; + } + if (isError != null && isError(e)) { + sc.addError(e as Object); + } else { + sc.add(e); + } } - if (isError != null && isError(e)) { - sc.addError(e as Object); - } else { - sc.add(e); - } - } - }).then((_) => sc?.close()); - }, - onCancel: () { - sc?.close(); - } - ); + }).then((_) => sc?.close()); + }, + onCancel: () { + sc?.close(); + }); return sc.stream; } diff --git a/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A02_t02.dart b/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A02_t02.dart index 1598dcd296..5cf525684f 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A02_t02.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A02_t02.dart @@ -18,29 +18,28 @@ import "dart:async"; import "../Stream/allTests_A02.lib.dart"; -Stream create( - Iterable data, {bool isError(T element)?, T? defaultValue}) { +Stream create(Iterable data, + {bool isError(T element)?, T? defaultValue}) { StreamController? sc; sc = new StreamController.broadcast( - sync: true, - onListen: () { - new Future(() { - for (T e in data) { - if (sc!.isClosed){ - break; + sync: true, + onListen: () { + new Future(() { + for (T e in data) { + if (sc!.isClosed) { + break; + } + if (isError != null && isError(e)) { + sc.addError(e as Object); + } else { + sc.add(e); + } } - if (isError != null && isError(e)) { - sc.addError(e as Object); - } else { - sc.add(e); - } - } - }).then((_) => sc?.close()); - }, - onCancel: () { - sc?.close(); - } - ); + }).then((_) => sc?.close()); + }, + onCancel: () { + sc?.close(); + }); return sc.stream; } diff --git a/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A02_t03.dart b/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A02_t03.dart index deeae7f43e..39f615f034 100644 --- a/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A02_t03.dart +++ b/LibTest/async/StreamController/StreamController.broadcast_Stream_all_A02_t03.dart @@ -22,25 +22,24 @@ import "../Stream/allTests_A03.lib.dart"; Stream create(Iterable data, {bool isError(T element)?}) { StreamController? sc; sc = new StreamController.broadcast( - sync: true, - onListen: () { - new Future(() { - for (T e in data) { - if (sc!.isClosed){ - break; + sync: true, + onListen: () { + new Future(() { + for (T e in data) { + if (sc!.isClosed) { + break; + } + if (isError != null && isError(e)) { + sc.addError(e as Object); + } else { + sc.add(e); + } } - if (isError != null && isError(e)) { - sc.addError(e as Object); - } else { - sc.add(e); - } - } - }).then((_) => sc?.close()); - }, - onCancel: () { - sc?.close(); - } - ); + }).then((_) => sc?.close()); + }, + onCancel: () { + sc?.close(); + }); return sc.stream; } diff --git a/LibTest/async/StreamController/StreamController_A02_t01.dart b/LibTest/async/StreamController/StreamController_A02_t01.dart index 892284083e..b27f3c65a9 100644 --- a/LibTest/async/StreamController/StreamController_A02_t01.dart +++ b/LibTest/async/StreamController/StreamController_A02_t01.dart @@ -23,10 +23,9 @@ main() { bool onDataCalled = false; asyncStart(); s.listen((var event) { - onDataCalled = true; - asyncEnd(); - } - ); + onDataCalled = true; + asyncEnd(); + }); controller.add(1); Expect.isFalse(onDataCalled); controller.close(); diff --git a/LibTest/async/StreamController/StreamController_A03_t01.dart b/LibTest/async/StreamController/StreamController_A03_t01.dart index 2469875847..414641b364 100644 --- a/LibTest/async/StreamController/StreamController_A03_t01.dart +++ b/LibTest/async/StreamController/StreamController_A03_t01.dart @@ -23,15 +23,12 @@ void check(List source) { Expect.isTrue(sink.isEmpty); asyncStart(); - s.listen( - (event) { - sink.add(event); - }, - onDone:() { - Expect.listEquals(source, sink); - asyncEnd(); - } - ); + s.listen((event) { + sink.add(event); + }, onDone: () { + Expect.listEquals(source, sink); + asyncEnd(); + }); controller.close(); } diff --git a/LibTest/async/StreamController/StreamController_A04_t01.dart b/LibTest/async/StreamController/StreamController_A04_t01.dart index fce9efdc6f..e2b7d4b176 100644 --- a/LibTest/async/StreamController/StreamController_A04_t01.dart +++ b/LibTest/async/StreamController/StreamController_A04_t01.dart @@ -15,9 +15,9 @@ import "../../../Utils/expect.dart"; main() { bool onPauseCalled = false; - StreamController controller = new StreamController( - onPause: () {onPauseCalled = true;} - ); + StreamController controller = new StreamController(onPause: () { + onPauseCalled = true; + }); StreamSubscription subs = controller.stream.listen((event) {}); controller.add(1); diff --git a/LibTest/async/StreamController/StreamController_A05_t01.dart b/LibTest/async/StreamController/StreamController_A05_t01.dart index 4f2f7cada6..f6addfc283 100644 --- a/LibTest/async/StreamController/StreamController_A05_t01.dart +++ b/LibTest/async/StreamController/StreamController_A05_t01.dart @@ -15,12 +15,10 @@ import "../../../Utils/expect.dart"; main() { bool onResumeCalled = false; asyncStart(); - StreamController controller = new StreamController( - onResume: () { - onResumeCalled = true; - asyncEnd(); - } - ); + StreamController controller = new StreamController(onResume: () { + onResumeCalled = true; + asyncEnd(); + }); StreamSubscription subs = controller.stream.listen((event) {}); controller.add(1); diff --git a/LibTest/async/StreamController/StreamController_A06_t01.dart b/LibTest/async/StreamController/StreamController_A06_t01.dart index 2414e0c437..247b560502 100644 --- a/LibTest/async/StreamController/StreamController_A06_t01.dart +++ b/LibTest/async/StreamController/StreamController_A06_t01.dart @@ -17,12 +17,10 @@ import "../../../Utils/expect.dart"; main() { bool onListenCalled = false; asyncStart(); - StreamController controller = new StreamController( - onListen: () { - onListenCalled = true; - asyncEnd(); - } - ); + StreamController controller = new StreamController(onListen: () { + onListenCalled = true; + asyncEnd(); + }); Expect.isFalse(onListenCalled); StreamSubscription subs = controller.stream.listen((event) {}); diff --git a/LibTest/async/StreamController/StreamController_A06_t02.dart b/LibTest/async/StreamController/StreamController_A06_t02.dart index 1bea4dc6ef..dc1f07deaa 100644 --- a/LibTest/async/StreamController/StreamController_A06_t02.dart +++ b/LibTest/async/StreamController/StreamController_A06_t02.dart @@ -17,19 +17,15 @@ import "../../../Utils/expect.dart"; main() { bool onCancelCalled = false; asyncStart(); - StreamController controller = new StreamController( - onCancel: () { - onCancelCalled = true; - } - ); + StreamController controller = new StreamController(onCancel: () { + onCancelCalled = true; + }); Expect.isFalse(onCancelCalled); StreamSubscription subs = controller.stream.listen((event) {}); - new Future(() => subs.cancel()).then( - (_) { - Expect.isTrue(onCancelCalled); - asyncEnd(); - } - ); + new Future(() => subs.cancel()).then((_) { + Expect.isTrue(onCancelCalled); + asyncEnd(); + }); } diff --git a/LibTest/async/StreamController/StreamController_A07_t01.dart b/LibTest/async/StreamController/StreamController_A07_t01.dart index 7b8ffaba8a..b8e2145e66 100644 --- a/LibTest/async/StreamController/StreamController_A07_t01.dart +++ b/LibTest/async/StreamController/StreamController_A07_t01.dart @@ -18,21 +18,15 @@ main() { asyncStart(); bool onCancelFutureComplete = false; StreamController controller = new StreamController( - onCancel: () => new Future.delayed( - durationInMilliseconds(100), - () { - onCancelFutureComplete = true; - } - ) - ); + onCancel: () => new Future.delayed(durationInMilliseconds(100), () { + onCancelFutureComplete = true; + })); Expect.isFalse(onCancelFutureComplete); StreamSubscription subs = controller.stream.listen((event) {}); - new Future(() => subs.cancel()).then( - (_) { - Expect.isTrue(onCancelFutureComplete); - asyncEnd(); - } - ); + new Future(() => subs.cancel()).then((_) { + Expect.isTrue(onCancelFutureComplete); + asyncEnd(); + }); } diff --git a/LibTest/async/StreamController/addError_A01_t01.dart b/LibTest/async/StreamController/addError_A01_t01.dart index c786fb44af..2292490bc3 100644 --- a/LibTest/async/StreamController/addError_A01_t01.dart +++ b/LibTest/async/StreamController/addError_A01_t01.dart @@ -16,14 +16,11 @@ main() { var error0 = 12345; controller.addError(error0); asyncStart(); - controller.stream.listen( - (value) { - Expect.fail("unexpected onData call"); - }, - onError: (error1) { - Expect.equals(error0, error1); - asyncEnd(); - } - ); + controller.stream.listen((value) { + Expect.fail("unexpected onData call"); + }, onError: (error1) { + Expect.equals(error0, error1); + asyncEnd(); + }); controller.close(); } diff --git a/LibTest/async/StreamController/addError_A01_t02.dart b/LibTest/async/StreamController/addError_A01_t02.dart index 8b43d49c33..90e4aef01f 100644 --- a/LibTest/async/StreamController/addError_A01_t02.dart +++ b/LibTest/async/StreamController/addError_A01_t02.dart @@ -22,15 +22,12 @@ main() { controller.addError(e, st); } asyncStart(); - controller.stream.listen( - (value) { - Expect.fail("unexpected onData call"); - }, - onError: (error1, stackTrace1) { - Expect.identical(error0, error1); - Expect.identical(stackTrace0, stackTrace1); - asyncEnd(); - } - ); + controller.stream.listen((value) { + Expect.fail("unexpected onData call"); + }, onError: (error1, stackTrace1) { + Expect.identical(error0, error1); + Expect.identical(stackTrace0, stackTrace1); + asyncEnd(); + }); controller.close(); } diff --git a/LibTest/async/StreamController/addStream_A02_t02.dart b/LibTest/async/StreamController/addStream_A02_t02.dart index a257d5c98a..643d58268d 100644 --- a/LibTest/async/StreamController/addStream_A02_t02.dart +++ b/LibTest/async/StreamController/addStream_A02_t02.dart @@ -17,19 +17,15 @@ listen(Stream stream, List expectedData, List expectedErrors) { List actualData = []; List actualErrors = []; - stream.listen( - (x) { - actualData.add(x); - }, - onError: (x) { - actualErrors.add(x); - }, - onDone: () { - Expect.listEquals(expectedData, actualData); - Expect.listEquals(expectedErrors, actualErrors); - asyncEnd(); - } - ); + stream.listen((x) { + actualData.add(x); + }, onError: (x) { + actualErrors.add(x); + }, onDone: () { + Expect.listEquals(expectedData, actualData); + Expect.listEquals(expectedErrors, actualErrors); + asyncEnd(); + }); } main() { diff --git a/LibTest/async/StreamController/addStream_A03_t01.dart b/LibTest/async/StreamController/addStream_A03_t01.dart index 80e7c8f8bd..aea0013a8e 100644 --- a/LibTest/async/StreamController/addStream_A03_t01.dart +++ b/LibTest/async/StreamController/addStream_A03_t01.dart @@ -19,23 +19,20 @@ void listen(Stream stream, List expectedData, List expectedErrors) { List actualData = []; List actualErrors = []; - stream.listen( - (x) { - actualData.add(x); - }, - onError: (x) { - actualErrors.add(x); - }, - onDone: () { - Expect.listEquals(expectedData, actualData); - Expect.listEquals(expectedErrors, actualErrors); - asyncEnd(); - } - ); + stream.listen((x) { + actualData.add(x); + }, onError: (x) { + actualErrors.add(x); + }, onDone: () { + Expect.listEquals(expectedData, actualData); + Expect.listEquals(expectedErrors, actualErrors); + asyncEnd(); + }); } // new stream, negative data become errors -Stream toDataErrorStream(Stream stream) => stream.map((x) => x < 0 ? throw x : x); +Stream toDataErrorStream(Stream stream) => + stream.map((x) => x < 0 ? throw x : x); main() { StreamController c = new StreamController(); @@ -46,7 +43,7 @@ main() { asyncStart(2); listen(c.stream, [1, 2, 3, 4, 5, 6, 1, 2, 3], [-1, -2, -3, -1]); c.addStream(s1).then((_) { - c.addStream(s2, cancelOnError:true).then((_) { + c.addStream(s2, cancelOnError: true).then((_) { c.close(); asyncEnd(); }); diff --git a/LibTest/async/StreamController/addStream_A03_t02.dart b/LibTest/async/StreamController/addStream_A03_t02.dart index 5b4756736c..e2a2c498e3 100644 --- a/LibTest/async/StreamController/addStream_A03_t02.dart +++ b/LibTest/async/StreamController/addStream_A03_t02.dart @@ -20,23 +20,20 @@ listen(Stream stream, List expectedData, List expectedErrors) { List actualData = []; List actualErrors = []; - stream.listen( - (x) { - actualData.add(x); - }, - onError: (x) { - actualErrors.add(x); - }, - onDone: () { - Expect.listEquals(expectedData, actualData); - Expect.listEquals(expectedErrors, actualErrors); - asyncEnd(); - } - ); + stream.listen((x) { + actualData.add(x); + }, onError: (x) { + actualErrors.add(x); + }, onDone: () { + Expect.listEquals(expectedData, actualData); + Expect.listEquals(expectedErrors, actualErrors); + asyncEnd(); + }); } // new stream, negative data become errors -Stream toDataErrorStream(Stream stream) => stream.map((x) => x < 0 ? throw x : x); +Stream toDataErrorStream(Stream stream) => + stream.map((x) => x < 0 ? throw x : x); main() { StreamController c = new StreamController(); @@ -45,7 +42,7 @@ main() { asyncStart(2); listen(c.stream, [1, 2, 3, 4, 5, 6], [-1, -2, -3]); - c.addStream(s, cancelOnError:false).then((_) { + c.addStream(s, cancelOnError: false).then((_) { c.close(); asyncEnd(); }); diff --git a/LibTest/async/StreamController/add_A01_t01.dart b/LibTest/async/StreamController/add_A01_t01.dart index c20cf4e9bc..15f1cb5b05 100644 --- a/LibTest/async/StreamController/add_A01_t01.dart +++ b/LibTest/async/StreamController/add_A01_t01.dart @@ -15,11 +15,9 @@ main() { var value0 = 12345; controller.add(value0); asyncStart(); - controller.stream.listen( - (value1) { - Expect.equals(value0, value1); - asyncEnd(); - } - ); + controller.stream.listen((value1) { + Expect.equals(value0, value1); + asyncEnd(); + }); controller.close(); } diff --git a/LibTest/async/StreamController/close_A01_t02.dart b/LibTest/async/StreamController/close_A01_t02.dart index 24926aa211..8dace313c5 100644 --- a/LibTest/async/StreamController/close_A01_t02.dart +++ b/LibTest/async/StreamController/close_A01_t02.dart @@ -17,15 +17,11 @@ main() { StreamController controller = new StreamController(); controller.close(); asyncStart(); - controller.stream.listen( - (value) { - Expect.fail("unexpected onData call"); - }, - onError: (error1) { - Expect.fail("unexpected onError call"); - }, - onDone: () { - asyncEnd(); - } - ); + controller.stream.listen((value) { + Expect.fail("unexpected onData call"); + }, onError: (error1) { + Expect.fail("unexpected onError call"); + }, onDone: () { + asyncEnd(); + }); } diff --git a/LibTest/async/StreamController/done_A01_t03.dart b/LibTest/async/StreamController/done_A01_t03.dart index 0c217247a8..01c32f022b 100644 --- a/LibTest/async/StreamController/done_A01_t03.dart +++ b/LibTest/async/StreamController/done_A01_t03.dart @@ -22,23 +22,19 @@ import "dart:async"; main() { var c = new StreamController(); - c.done - .then((x) { - print('completed with value $x'); - }) - .catchError((x) { - print('completed with error $x'); - }); + c.done.then((x) { + print('completed with value $x'); + }).catchError((x) { + print('completed with error $x'); + }); c.addError(1); c.stream.listen(null, onError: (_) {}); - c.close() - .then((x) { - print('completed with value $x'); - }) - .catchError((x) { - print('completed with error $x'); - }); + c.close().then((x) { + print('completed with value $x'); + }).catchError((x) { + print('completed with error $x'); + }); } diff --git a/LibTest/async/StreamController/hasListener_A01_t01.dart b/LibTest/async/StreamController/hasListener_A01_t01.dart index 490c26982f..76e7077cf6 100644 --- a/LibTest/async/StreamController/hasListener_A01_t01.dart +++ b/LibTest/async/StreamController/hasListener_A01_t01.dart @@ -16,7 +16,9 @@ main() { Expect.isFalse(controller.hasListener); List events1 = new List.empty(growable: true); - StreamSubscription ss = s.listen((event) {events1.add(event);}); + StreamSubscription ss = s.listen((event) { + events1.add(event); + }); Expect.isTrue(controller.hasListener); ss.cancel(); diff --git a/LibTest/async/StreamController/hasListener_A01_t02.dart b/LibTest/async/StreamController/hasListener_A01_t02.dart index 19da4f61f4..8ffceadf94 100644 --- a/LibTest/async/StreamController/hasListener_A01_t02.dart +++ b/LibTest/async/StreamController/hasListener_A01_t02.dart @@ -17,10 +17,14 @@ main() { Expect.isFalse(controller.hasListener); List events1 = new List.empty(growable: true); - StreamSubscription ss1 = s.listen((event) {events1.add(event);}); + StreamSubscription ss1 = s.listen((event) { + events1.add(event); + }); Expect.isTrue(controller.hasListener); - StreamSubscription ss2 = s.listen((event) {events1.add(event);}); + StreamSubscription ss2 = s.listen((event) { + events1.add(event); + }); Expect.isTrue(controller.hasListener); ss1.cancel(); @@ -29,7 +33,9 @@ main() { ss2.cancel(); Expect.isFalse(controller.hasListener); - ss2 = s.listen((event){events1.add(event);}); + ss2 = s.listen((event) { + events1.add(event); + }); Expect.isTrue(controller.hasListener); ss2.cancel(); diff --git a/LibTest/async/StreamController/isClosed_A01_t01.dart b/LibTest/async/StreamController/isClosed_A01_t01.dart index b2aafc0139..233b084de1 100644 --- a/LibTest/async/StreamController/isClosed_A01_t01.dart +++ b/LibTest/async/StreamController/isClosed_A01_t01.dart @@ -19,8 +19,9 @@ main() { Expect.isFalse(controller.isClosed); List events1 = new List.empty(growable: true); - StreamSubscription ss = controller.stream.listen( - (event) {events1.add(event);}); + StreamSubscription ss = controller.stream.listen((event) { + events1.add(event); + }); Expect.isFalse(controller.isClosed); controller.add(1); @@ -29,5 +30,5 @@ main() { controller.close(); Expect.isTrue(controller.isClosed); - Expect.throws(() => controller.add(0), null, "add() works after close()"); + Expect.throws(() => controller.add(0), null, "add() works after close()"); } diff --git a/LibTest/async/StreamController/isClosed_A01_t02.dart b/LibTest/async/StreamController/isClosed_A01_t02.dart index bec93fd3c6..fa6a408b00 100644 --- a/LibTest/async/StreamController/isClosed_A01_t02.dart +++ b/LibTest/async/StreamController/isClosed_A01_t02.dart @@ -20,8 +20,9 @@ main() { Expect.isFalse(controller.isClosed); List events1 = new List.empty(growable: true); - StreamSubscription ss = controller.stream.listen( - (event) {events1.add(event);}); + StreamSubscription ss = controller.stream.listen((event) { + events1.add(event); + }); Expect.isFalse(controller.isClosed); controller.add(1); @@ -30,6 +31,5 @@ main() { controller.close(); Expect.isTrue(controller.isClosed); - Expect.throws(() => controller.add(0), null, "add() works after close()"); - + Expect.throws(() => controller.add(0), null, "add() works after close()"); } diff --git a/LibTest/async/StreamController/isPaused_A01_t01.dart b/LibTest/async/StreamController/isPaused_A01_t01.dart index 53eab5e4cb..1caa4ce4db 100644 --- a/LibTest/async/StreamController/isPaused_A01_t01.dart +++ b/LibTest/async/StreamController/isPaused_A01_t01.dart @@ -18,9 +18,9 @@ import "../../../Utils/expect.dart"; main() { StreamController controller = new StreamController(); List events1 = new List.empty(growable: true); - StreamSubscription ss = controller.stream.listen( - (event) {events1.add(event);} - ); + StreamSubscription ss = controller.stream.listen((event) { + events1.add(event); + }); ss.pause(); Expect.isTrue(controller.isPaused); diff --git a/LibTest/async/StreamController/isPaused_A01_t03.dart b/LibTest/async/StreamController/isPaused_A01_t03.dart index 1b28ee0b33..0e29e86b01 100644 --- a/LibTest/async/StreamController/isPaused_A01_t03.dart +++ b/LibTest/async/StreamController/isPaused_A01_t03.dart @@ -21,9 +21,9 @@ main() { Expect.isFalse(controller.isPaused); List events1 = new List.empty(growable: true); - StreamSubscription ss = controller.stream.listen( - (event) {events1.add(event);} - ); + StreamSubscription ss = controller.stream.listen((event) { + events1.add(event); + }); Expect.isFalse(controller.isPaused); ss.pause(); diff --git a/LibTest/async/StreamController/sink_A01_t01.dart b/LibTest/async/StreamController/sink_A01_t01.dart index 71b69f58aa..7e7da23883 100644 --- a/LibTest/async/StreamController/sink_A01_t01.dart +++ b/LibTest/async/StreamController/sink_A01_t01.dart @@ -25,8 +25,16 @@ main() { sink.toString(); sink.close(); - Expect.throws(() {var v = sink.hasListener;}); - Expect.throws(() {var v = sink.isClosed;}); - Expect.throws(() {var v = sink.isPaused;}); - Expect.throws(() {var v = sink.stream;}); + Expect.throws(() { + var v = sink.hasListener; + }); + Expect.throws(() { + var v = sink.isClosed; + }); + Expect.throws(() { + var v = sink.isPaused; + }); + Expect.throws(() { + var v = sink.stream; + }); } diff --git a/LibTest/async/StreamController/stream_all_A01_t02.dart b/LibTest/async/StreamController/stream_all_A01_t02.dart index 14d415acbb..9ff3a8b21e 100644 --- a/LibTest/async/StreamController/stream_all_A01_t02.dart +++ b/LibTest/async/StreamController/stream_all_A01_t02.dart @@ -10,8 +10,8 @@ import "dart:async"; import "../Stream/allTests_A02.lib.dart"; -Stream create( - Iterable data, {bool isError(T element)?, T? defaultValue}) { +Stream create(Iterable data, + {bool isError(T element)?, T? defaultValue}) { StreamController sc = new StreamController(); for (T e in data) { if (isError != null && isError(e)) { diff --git a/LibTest/async/StreamController/stream_all_A02_t01.dart b/LibTest/async/StreamController/stream_all_A02_t01.dart index d63b4971c5..d49ddff6a0 100644 --- a/LibTest/async/StreamController/stream_all_A02_t01.dart +++ b/LibTest/async/StreamController/stream_all_A02_t01.dart @@ -13,25 +13,24 @@ import "../Stream/allTests_A01.lib.dart"; Stream create(Iterable data, {bool isError(T element)?}) { StreamController? sc; sc = new StreamController( - sync: true, - onListen: () { - new Future(() { - for (T e in data) { - if (sc!.isClosed){ - break; + sync: true, + onListen: () { + new Future(() { + for (T e in data) { + if (sc!.isClosed) { + break; + } + if (isError != null && isError(e)) { + sc.addError(e as Object); + } else { + sc.add(e); + } } - if (isError != null && isError(e)) { - sc.addError(e as Object); - } else { - sc.add(e); - } - } - }).then((_) => sc?.close()); - }, - onCancel: () { - sc?.close(); - } - ); + }).then((_) => sc?.close()); + }, + onCancel: () { + sc?.close(); + }); return sc.stream; } diff --git a/LibTest/async/StreamController/stream_all_A02_t02.dart b/LibTest/async/StreamController/stream_all_A02_t02.dart index ab2025ed72..42d0edcd70 100644 --- a/LibTest/async/StreamController/stream_all_A02_t02.dart +++ b/LibTest/async/StreamController/stream_all_A02_t02.dart @@ -10,28 +10,28 @@ import "dart:async"; import "../Stream/allTests_A02.lib.dart"; -Stream create(Iterable data, {bool isError(T element)?, T? defaultValue}) { +Stream create(Iterable data, + {bool isError(T element)?, T? defaultValue}) { StreamController? sc; sc = new StreamController( - sync: true, - onListen: () { - new Future(() { - for (T e in data) { - if (sc!.isClosed){ - break; + sync: true, + onListen: () { + new Future(() { + for (T e in data) { + if (sc!.isClosed) { + break; + } + if (isError != null && isError(e)) { + sc.addError(e as Object); + } else { + sc.add(e); + } } - if (isError != null && isError(e)) { - sc.addError(e as Object); - } else { - sc.add(e); - } - } - }).then((_) => sc?.close()); - }, - onCancel: () { - sc?.close(); - } - ); + }).then((_) => sc?.close()); + }, + onCancel: () { + sc?.close(); + }); return sc.stream; } diff --git a/LibTest/async/StreamController/stream_all_A02_t03.dart b/LibTest/async/StreamController/stream_all_A02_t03.dart index 6578e0314a..21b9219a6e 100644 --- a/LibTest/async/StreamController/stream_all_A02_t03.dart +++ b/LibTest/async/StreamController/stream_all_A02_t03.dart @@ -14,25 +14,24 @@ import "../Stream/allTests_A03.lib.dart"; Stream create(Iterable data, {bool isError(T element)?}) { StreamController? sc; sc = new StreamController( - sync:true, - onListen:() { - new Future(() { - for (T e in data) { - if (sc!.isClosed){ - break; + sync: true, + onListen: () { + new Future(() { + for (T e in data) { + if (sc!.isClosed) { + break; + } + if (isError != null && isError(e)) { + sc.addError(e as Object); + } else { + sc.add(e); + } } - if (isError != null && isError(e)) { - sc.addError(e as Object); - } else { - sc.add(e); - } - } - }).then((_) => sc?.close()); - }, - onCancel: () { - sc?.close(); - } - ); + }).then((_) => sc?.close()); + }, + onCancel: () { + sc?.close(); + }); return sc.stream; } diff --git a/LibTest/async/StreamIterator/cancel_A01_t01.dart b/LibTest/async/StreamIterator/cancel_A01_t01.dart index 10b5dfaff6..660d22632c 100644 --- a/LibTest/async/StreamIterator/cancel_A01_t01.dart +++ b/LibTest/async/StreamIterator/cancel_A01_t01.dart @@ -44,6 +44,7 @@ void check(List source, List expected) { } streamIterator.moveNext().then(step); } + streamIterator.moveNext().then(step); } diff --git a/LibTest/async/StreamIterator/current_A01_t02.dart b/LibTest/async/StreamIterator/current_A01_t02.dart index 27171495e8..307b6784ab 100644 --- a/LibTest/async/StreamIterator/current_A01_t02.dart +++ b/LibTest/async/StreamIterator/current_A01_t02.dart @@ -38,7 +38,6 @@ main() { Expect.isNull(si.current); asyncEnd(); }); - }); c.close(); diff --git a/LibTest/async/StreamIterator/moveNext_A01_t01.dart b/LibTest/async/StreamIterator/moveNext_A01_t01.dart index 3f387467b4..e5a88b59c1 100644 --- a/LibTest/async/StreamIterator/moveNext_A01_t01.dart +++ b/LibTest/async/StreamIterator/moveNext_A01_t01.dart @@ -37,6 +37,7 @@ main() { } }); } + asyncStart(); f(); } diff --git a/LibTest/async/StreamSink/StreamSink_inherited_tests.lib.dart b/LibTest/async/StreamSink/StreamSink_inherited_tests.lib.dart index e767563cf3..75fb55fe8c 100644 --- a/LibTest/async/StreamSink/StreamSink_inherited_tests.lib.dart +++ b/LibTest/async/StreamSink/StreamSink_inherited_tests.lib.dart @@ -8,6 +8,7 @@ /// @author ngl@unipro.ru library inherited_tests_streamcontroller; + import "dart:async"; import "../EventSink/all_tests.lib.dart" as allTest_EventSink; diff --git a/LibTest/async/StreamSink/addStream_A01_t01.dart b/LibTest/async/StreamSink/addStream_A01_t01.dart index c5001c4cf9..1b2a81d636 100644 --- a/LibTest/async/StreamSink/addStream_A01_t01.dart +++ b/LibTest/async/StreamSink/addStream_A01_t01.dart @@ -15,7 +15,7 @@ import "dart:async"; import "../../../Utils/expect.dart"; main() { - var from = new Stream.fromIterable([1,2,3,4,5]); + var from = new Stream.fromIterable([1, 2, 3, 4, 5]); var c = new StreamController(); var sink = c.sink; @@ -27,7 +27,7 @@ main() { }); c.stream.toList().then((x) { - Expect.listEquals([1,2,3,4,5], x); + Expect.listEquals([1, 2, 3, 4, 5], x); asyncEnd(); }); } diff --git a/LibTest/async/StreamSink/add_A01_t01.dart b/LibTest/async/StreamSink/add_A01_t01.dart index ff8e426f56..d68174d750 100644 --- a/LibTest/async/StreamSink/add_A01_t01.dart +++ b/LibTest/async/StreamSink/add_A01_t01.dart @@ -18,7 +18,7 @@ main() { asyncStart(); c.stream.toList().then((x) { - Expect.listEquals([1,2], x); + Expect.listEquals([1, 2], x); asyncEnd(); }); c.close(); diff --git a/LibTest/async/StreamTransformer/StreamTransformer.fromHandlers_A01_t04.dart b/LibTest/async/StreamTransformer/StreamTransformer.fromHandlers_A01_t04.dart index f32209ad9d..908e58c11d 100644 --- a/LibTest/async/StreamTransformer/StreamTransformer.fromHandlers_A01_t04.dart +++ b/LibTest/async/StreamTransformer/StreamTransformer.fromHandlers_A01_t04.dart @@ -16,21 +16,24 @@ import "../../../Utils/expect.dart"; main() { Stream s = new Stream.fromIterable([1, 2, 3, 4, 5]); - + // odd numbers as data events, even numbers as error events s = s.map((x) => x.isOdd ? x : throw x); - StreamTransformer tr = new StreamTransformer.fromHandlers( - handleData: (x, sink) { sink.add(x); }, - handleError: (x, st, sink) { sink.add(x); }, - handleDone: (sink) { sink.add(6); sink.add(7); sink.close(); } - ); - + StreamTransformer tr = + new StreamTransformer.fromHandlers(handleData: (x, sink) { + sink.add(x); + }, handleError: (x, st, sink) { + sink.add(x); + }, handleDone: (sink) { + sink.add(6); + sink.add(7); + sink.close(); + }); + asyncStart(); - s.transform(tr).toList().then( - (x) { - Expect.listEquals([1, 2, 3, 4, 5, 6, 7], x); - asyncEnd(); - } - ); + s.transform(tr).toList().then((x) { + Expect.listEquals([1, 2, 3, 4, 5, 6, 7], x); + asyncEnd(); + }); } diff --git a/LibTest/async/StreamTransformer/StreamTransformer_A01_t02.dart b/LibTest/async/StreamTransformer/StreamTransformer_A01_t02.dart index ad18e0e285..36d8e19c28 100644 --- a/LibTest/async/StreamTransformer/StreamTransformer_A01_t02.dart +++ b/LibTest/async/StreamTransformer/StreamTransformer_A01_t02.dart @@ -20,11 +20,10 @@ import "../../../Utils/expect.dart"; main() { Stream s = new Stream.fromIterable([1]); - StreamTransformer tr = new StreamTransformer( - (stream, cancelOnError) { - Expect.fail('unexpected call to transformer'); - return stream.listen((var x) {}); - } - ); + StreamTransformer tr = + new StreamTransformer((stream, cancelOnError) { + Expect.fail('unexpected call to transformer'); + return stream.listen((var x) {}); + }); s.transform(tr); } diff --git a/LibTest/async/StreamTransformer/StreamTransformer_A01_t03.dart b/LibTest/async/StreamTransformer/StreamTransformer_A01_t03.dart index a601e6b53c..fe7a087e2d 100644 --- a/LibTest/async/StreamTransformer/StreamTransformer_A01_t03.dart +++ b/LibTest/async/StreamTransformer/StreamTransformer_A01_t03.dart @@ -20,12 +20,11 @@ import "../../../Utils/expect.dart"; main() { Stream s = new Stream.fromIterable([1]); - StreamTransformer tr = new StreamTransformer( - (stream, cancelOnError) { - asyncEnd(); - return stream.listen(null); - } - ); + StreamTransformer tr = + new StreamTransformer((stream, cancelOnError) { + asyncEnd(); + return stream.listen(null); + }); asyncStart(); s.transform(tr).toList(); diff --git a/LibTest/async/StreamTransformer/StreamTransformer_A02_t01.dart b/LibTest/async/StreamTransformer/StreamTransformer_A02_t01.dart index 30fcd0e353..4c4952fdb0 100644 --- a/LibTest/async/StreamTransformer/StreamTransformer_A02_t01.dart +++ b/LibTest/async/StreamTransformer/StreamTransformer_A02_t01.dart @@ -18,13 +18,12 @@ import "../../../Utils/expect.dart"; main() { Stream source = new Stream.fromIterable([1]); - StreamTransformer tr = new StreamTransformer( - (stream, cancelOnError) { - Expect.identical(source, stream); - asyncEnd(); - return stream.listen(null); - } - ); + StreamTransformer tr = + new StreamTransformer((stream, cancelOnError) { + Expect.identical(source, stream); + asyncEnd(); + return stream.listen(null); + }); asyncStart(); source.transform(tr).toList(); diff --git a/LibTest/async/StreamTransformer/StreamTransformer_A02_t02.dart b/LibTest/async/StreamTransformer/StreamTransformer_A02_t02.dart index 89cd3bebfc..1b343ee9a7 100644 --- a/LibTest/async/StreamTransformer/StreamTransformer_A02_t02.dart +++ b/LibTest/async/StreamTransformer/StreamTransformer_A02_t02.dart @@ -19,18 +19,14 @@ import "../../../Utils/expect.dart"; main() { Stream s = new Stream.fromIterable([1]); - StreamTransformer tr = new StreamTransformer( - (_, __) { - Stream s2 = new Stream.fromIterable([2]); - return s2.listen(null); - } - ); + StreamTransformer tr = new StreamTransformer((_, __) { + Stream s2 = new Stream.fromIterable([2]); + return s2.listen(null); + }); asyncStart(); - s.transform(tr).toList().then( - (x) { - Expect.listEquals([2], x); - asyncEnd(); - } - ); + s.transform(tr).toList().then((x) { + Expect.listEquals([2], x); + asyncEnd(); + }); } diff --git a/LibTest/async/StreamTransformer/StreamTransformer_A03_t01.dart b/LibTest/async/StreamTransformer/StreamTransformer_A03_t01.dart index 36d57ffa1e..0a96862d9b 100644 --- a/LibTest/async/StreamTransformer/StreamTransformer_A03_t01.dart +++ b/LibTest/async/StreamTransformer/StreamTransformer_A03_t01.dart @@ -22,35 +22,26 @@ main() { c.addError(1); c.add(2); - StreamTransformer tr = new StreamTransformer( - (Stream stream, bool cancelOnError) { - return stream.listen( - (x) { - Expect.fail('unexpected call to OnData'); - }, - onError:(x) { - Expect.fail('unexpected call to OnError'); - }, - onDone:() { - Expect.fail('unexpected call to OnDone'); - } - ); - } - ); + StreamTransformer tr = + new StreamTransformer((Stream stream, bool cancelOnError) { + return stream.listen((x) { + Expect.fail('unexpected call to OnData'); + }, onError: (x) { + Expect.fail('unexpected call to OnError'); + }, onDone: () { + Expect.fail('unexpected call to OnDone'); + }); + }); asyncStart(3); - c.stream.transform(tr).listen( - (x) { - asyncEnd(); - }, - onError:(x) { - asyncEnd(); - }, - onDone:() { - asyncEnd(); - } - ); + c.stream.transform(tr).listen((x) { + asyncEnd(); + }, onError: (x) { + asyncEnd(); + }, onDone: () { + asyncEnd(); + }); c.close(); } diff --git a/LibTest/async/StreamTransformer/StreamTransformer_A03_t02.dart b/LibTest/async/StreamTransformer/StreamTransformer_A03_t02.dart index f6765bd3f0..5c96d4e4b1 100644 --- a/LibTest/async/StreamTransformer/StreamTransformer_A03_t02.dart +++ b/LibTest/async/StreamTransformer/StreamTransformer_A03_t02.dart @@ -18,26 +18,20 @@ import "../../../Utils/expect.dart"; // transform: skip evens, produce number and its double, convert errors to data myTransformer() { - return new StreamTransformer( - (Stream s, _) { - StreamController c = new StreamController(); - s.listen( - (x) { - if (x.isOdd) { - c.add(x); - c.add(x*2); - } - }, - onError:(x) { - c.add(x); - }, - onDone:() { - c.close(); - } - ); - return c.stream.listen(null); - } - ); + return new StreamTransformer((Stream s, _) { + StreamController c = new StreamController(); + s.listen((x) { + if (x.isOdd) { + c.add(x); + c.add(x * 2); + } + }, onError: (x) { + c.add(x); + }, onDone: () { + c.close(); + }); + return c.stream.listen(null); + }); } main() { @@ -54,11 +48,9 @@ main() { c.addError(5); asyncStart(); - c.stream.transform(myTransformer()).toList().then( - (x) { - Expect.listEquals([1,2,3,6,5,10,1,2,3,4,5], x); - asyncEnd(); - } - ); + c.stream.transform(myTransformer()).toList().then((x) { + Expect.listEquals([1, 2, 3, 6, 5, 10, 1, 2, 3, 4, 5], x); + asyncEnd(); + }); c.close(); } diff --git a/LibTest/async/Timer/cancel_A01_t01.dart b/LibTest/async/Timer/cancel_A01_t01.dart index b2f863c735..fd8fef695d 100644 --- a/LibTest/async/Timer/cancel_A01_t01.dart +++ b/LibTest/async/Timer/cancel_A01_t01.dart @@ -15,11 +15,10 @@ main() { int count = 0; Timer timer = new Timer.periodic(durationInMilliseconds(delay), (Timer t) { - count++; - } - ); + count++; + }); timer.cancel(); - + asyncStart(); new Timer(durationInMilliseconds(delay * 3), () { Expect.equals(count, 0); diff --git a/LibTest/async/Timer/cancel_A01_t02.dart b/LibTest/async/Timer/cancel_A01_t02.dart index 908c7acfc8..2c759d8788 100644 --- a/LibTest/async/Timer/cancel_A01_t02.dart +++ b/LibTest/async/Timer/cancel_A01_t02.dart @@ -15,11 +15,10 @@ main() { int count = 0; Timer timer = new Timer(durationInMilliseconds(delay), () { - count++; - } - ); + count++; + }); timer.cancel(); - + asyncStart(); new Timer(durationInMilliseconds(delay * 3), () { Expect.equals(count, 0); diff --git a/LibTest/async/Zone/bindBinaryCallbackGuarded_A01_t01.dart b/LibTest/async/Zone/bindBinaryCallbackGuarded_A01_t01.dart index 26428216f1..c266a9cd78 100644 --- a/LibTest/async/Zone/bindBinaryCallbackGuarded_A01_t01.dart +++ b/LibTest/async/Zone/bindBinaryCallbackGuarded_A01_t01.dart @@ -13,7 +13,6 @@ /// @description Checks that [callback] is run in the zone it was bound to. /// @author a.semenov@unipro.ru - import "dart:async"; import "../../../Utils/expect.dart"; diff --git a/LibTest/async/Zone/bindBinaryCallbackGuarded_A01_t02.dart b/LibTest/async/Zone/bindBinaryCallbackGuarded_A01_t02.dart index 3df20dda14..3399d4e69f 100644 --- a/LibTest/async/Zone/bindBinaryCallbackGuarded_A01_t02.dart +++ b/LibTest/async/Zone/bindBinaryCallbackGuarded_A01_t02.dart @@ -13,7 +13,6 @@ /// @description Checks that synchronous [callback] errors are caught in zone /// @author a.semenov@unipro.ru - import "dart:async"; import "../../../Utils/expect.dart"; @@ -26,11 +25,8 @@ main() { caughtError = e; } - Zone zone = Zone.current.fork( - specification: new ZoneSpecification( - handleUncaughtError: handler - ) - ); + Zone zone = Zone.current + .fork(specification: new ZoneSpecification(handleUncaughtError: handler)); void callback(int x, int y) { Expect.equals(1, x); @@ -39,8 +35,8 @@ main() { } void Function(int, int) boundCallback = - zone.bindBinaryCallbackGuarded(callback); - boundCallback(1,2); + zone.bindBinaryCallbackGuarded(callback); + boundCallback(1, 2); Expect.equals(1, handlerCallCount); Expect.equals("callback error", caughtError); } diff --git a/LibTest/async/Zone/bindBinaryCallback_A01_t01.dart b/LibTest/async/Zone/bindBinaryCallback_A01_t01.dart index 34421666eb..5f8f037f1a 100644 --- a/LibTest/async/Zone/bindBinaryCallback_A01_t01.dart +++ b/LibTest/async/Zone/bindBinaryCallback_A01_t01.dart @@ -26,7 +26,7 @@ main() { } ZoneBinaryCallback boundCallback = - zone.bindBinaryCallback(callback); + zone.bindBinaryCallback(callback); int? result = null; runZoned(() { diff --git a/LibTest/async/Zone/bindCallbackGuarded_A01_t02.dart b/LibTest/async/Zone/bindCallbackGuarded_A01_t02.dart index 2461ebe385..b44166023d 100644 --- a/LibTest/async/Zone/bindCallbackGuarded_A01_t02.dart +++ b/LibTest/async/Zone/bindCallbackGuarded_A01_t02.dart @@ -25,11 +25,8 @@ main() { caughtError = e; } - Zone zone = Zone.current.fork( - specification: new ZoneSpecification( - handleUncaughtError: handler - ) - ); + Zone zone = Zone.current + .fork(specification: new ZoneSpecification(handleUncaughtError: handler)); void callback() { throw "callback error"; diff --git a/LibTest/async/Zone/bindCallback_A01_t02.dart b/LibTest/async/Zone/bindCallback_A01_t02.dart index c8ad378683..b1e196010d 100644 --- a/LibTest/async/Zone/bindCallback_A01_t02.dart +++ b/LibTest/async/Zone/bindCallback_A01_t02.dart @@ -24,11 +24,8 @@ main() { handlerCallCount++; } - Zone zone = Zone.current.fork( - specification: new ZoneSpecification( - handleUncaughtError: handler - ) - ); + Zone zone = Zone.current + .fork(specification: new ZoneSpecification(handleUncaughtError: handler)); int callback() { throw "callback error"; diff --git a/LibTest/async/Zone/bindUnaryCallbackGuarded_A01_t01.dart b/LibTest/async/Zone/bindUnaryCallbackGuarded_A01_t01.dart index f21913f31b..06bfeb33ee 100644 --- a/LibTest/async/Zone/bindUnaryCallbackGuarded_A01_t01.dart +++ b/LibTest/async/Zone/bindUnaryCallbackGuarded_A01_t01.dart @@ -27,7 +27,7 @@ main() { } void Function(int) boundCallback = - zone.bindUnaryCallbackGuarded(callback); + zone.bindUnaryCallbackGuarded(callback); runZoned(() { boundCallback(3); diff --git a/LibTest/async/Zone/bindUnaryCallbackGuarded_A01_t02.dart b/LibTest/async/Zone/bindUnaryCallbackGuarded_A01_t02.dart index ade42addfb..ed7d15d4f1 100644 --- a/LibTest/async/Zone/bindUnaryCallbackGuarded_A01_t02.dart +++ b/LibTest/async/Zone/bindUnaryCallbackGuarded_A01_t02.dart @@ -27,11 +27,8 @@ main() { caughtError = e; } - Zone zone = Zone.current.fork( - specification: new ZoneSpecification( - handleUncaughtError: handler - ) - ); + Zone zone = Zone.current + .fork(specification: new ZoneSpecification(handleUncaughtError: handler)); void callback(int x) { Expect.equals(1, x); @@ -39,7 +36,7 @@ main() { } void Function(int) boundCallback = - zone.bindUnaryCallbackGuarded(callback); + zone.bindUnaryCallbackGuarded(callback); boundCallback(1); Expect.equals(1, handlerCallCount); Expect.equals("callback error", caughtError); diff --git a/LibTest/async/Zone/bindUnaryCallback_A01_t01.dart b/LibTest/async/Zone/bindUnaryCallback_A01_t01.dart index dafb7c0023..b00228b391 100644 --- a/LibTest/async/Zone/bindUnaryCallback_A01_t01.dart +++ b/LibTest/async/Zone/bindUnaryCallback_A01_t01.dart @@ -27,7 +27,7 @@ main() { } ZoneUnaryCallback boundCallback = - zone.bindUnaryCallback(callback); + zone.bindUnaryCallback(callback); int? result = null; runZoned(() { diff --git a/LibTest/async/Zone/bindUnaryCallback_A01_t02.dart b/LibTest/async/Zone/bindUnaryCallback_A01_t02.dart index 4115c0e465..5c24243219 100644 --- a/LibTest/async/Zone/bindUnaryCallback_A01_t02.dart +++ b/LibTest/async/Zone/bindUnaryCallback_A01_t02.dart @@ -24,18 +24,15 @@ main() { handlerCallCount++; } - Zone zone = Zone.current.fork( - specification: new ZoneSpecification( - handleUncaughtError: handler - ) - ); + Zone zone = Zone.current + .fork(specification: new ZoneSpecification(handleUncaughtError: handler)); int callback(int x) { throw "callback error"; } - ZoneUnaryCallback boundCallback = - zone.bindUnaryCallback(callback); - Expect.throws( () => boundCallback(2), (e) => e == "callback error"); + ZoneUnaryCallback boundCallback = + zone.bindUnaryCallback(callback); + Expect.throws(() => boundCallback(2), (e) => e == "callback error"); Expect.equals(0, handlerCallCount); } diff --git a/LibTest/async/Zone/createTimer_A01_t01.dart b/LibTest/async/Zone/createTimer_A01_t01.dart index 474dc970eb..cf19acf408 100644 --- a/LibTest/async/Zone/createTimer_A01_t01.dart +++ b/LibTest/async/Zone/createTimer_A01_t01.dart @@ -8,7 +8,6 @@ /// is executed in this zone. /// @author ilya - import "dart:async"; import "../../../Utils/expect.dart"; diff --git a/LibTest/async/Zone/current_A01_t02.dart b/LibTest/async/Zone/current_A01_t02.dart index 5022c0cb11..3cc4a62514 100644 --- a/LibTest/async/Zone/current_A01_t02.dart +++ b/LibTest/async/Zone/current_A01_t02.dart @@ -29,7 +29,7 @@ main() { } zone.fork().run(zoned); - + asyncEnd(); }); } diff --git a/LibTest/async/Zone/fork_A01_t01.dart b/LibTest/async/Zone/fork_A01_t01.dart index d3844c4b2f..44bb0ca9d0 100644 --- a/LibTest/async/Zone/fork_A01_t01.dart +++ b/LibTest/async/Zone/fork_A01_t01.dart @@ -11,7 +11,7 @@ import "dart:async"; import "../../../Utils/expect.dart"; -int count=0; +int count = 0; void test(Zone z) { Zone z2 = z.fork(); diff --git a/LibTest/async/Zone/handleUncaughtError_A01_t02.dart b/LibTest/async/Zone/handleUncaughtError_A01_t02.dart index 58de45b880..b175a0b88c 100644 --- a/LibTest/async/Zone/handleUncaughtError_A01_t02.dart +++ b/LibTest/async/Zone/handleUncaughtError_A01_t02.dart @@ -29,9 +29,9 @@ void myErrorHandler(Zone self, ZoneDelegate parent, Zone zone, e, st) { } main() { - Zone.current.fork( - specification: new ZoneSpecification( - handleUncaughtError: myErrorHandler - ) - ).run(test); + Zone.current + .fork( + specification: + new ZoneSpecification(handleUncaughtError: myErrorHandler)) + .run(test); } diff --git a/LibTest/async/Zone/handleUncaughtError_A01_t03.dart b/LibTest/async/Zone/handleUncaughtError_A01_t03.dart index 28e9531593..46239aa2b4 100644 --- a/LibTest/async/Zone/handleUncaughtError_A01_t03.dart +++ b/LibTest/async/Zone/handleUncaughtError_A01_t03.dart @@ -5,14 +5,14 @@ /// @assertion void handleUncaughtError(error, StackTrace stackTrace) /// Handles uncaught asynchronous errors. /// @description Checks that handleUncaughtError callback can be set via -/// ZoneSpecification and that correct callback is invoked. +/// ZoneSpecification and that correct callback is invoked. /// @author ilya import "dart:async"; import "../../../Utils/expect.dart"; int count = 0; -var stackTraces={}; +var stackTraces = {}; HandleUncaughtErrorHandler newHandler() { int id = ++count; @@ -22,8 +22,8 @@ HandleUncaughtErrorHandler newHandler() { }; } -Zone newErrorZone (Zone z) => - z.fork(specification: new ZoneSpecification(handleUncaughtError: newHandler())); +Zone newErrorZone(Zone z) => z.fork( + specification: new ZoneSpecification(handleUncaughtError: newHandler())); void test() { try { diff --git a/LibTest/async/Zone/handleUncaughtError_A01_t04.dart b/LibTest/async/Zone/handleUncaughtError_A01_t04.dart index a37a55f67d..0a35757f81 100644 --- a/LibTest/async/Zone/handleUncaughtError_A01_t04.dart +++ b/LibTest/async/Zone/handleUncaughtError_A01_t04.dart @@ -12,7 +12,7 @@ import "dart:async"; import "../../../Utils/expect.dart"; int count = 0; -var stackTraces={}; +var stackTraces = {}; HandleUncaughtErrorHandler newHandler() { int id = ++count; @@ -23,8 +23,8 @@ HandleUncaughtErrorHandler newHandler() { }; } -Zone newErrorZone(Zone z) => - z.fork(specification: new ZoneSpecification(handleUncaughtError: newHandler())); +Zone newErrorZone(Zone z) => z.fork( + specification: new ZoneSpecification(handleUncaughtError: newHandler())); void test() { try { @@ -34,11 +34,11 @@ void test() { asyncStart(2); - new Future.error(e,st); + new Future.error(e, st); runZoned(() { // in same error zone as parent zone - new Future.error(e,st); + new Future.error(e, st); }); } diff --git a/LibTest/async/Zone/inSameErrorZone_A01_t03.dart b/LibTest/async/Zone/inSameErrorZone_A01_t03.dart index 7495fb8983..3206b3378a 100644 --- a/LibTest/async/Zone/inSameErrorZone_A01_t03.dart +++ b/LibTest/async/Zone/inSameErrorZone_A01_t03.dart @@ -16,7 +16,7 @@ same() { Zone? z = Zone.current.parent; if (z != null) { Expect.isTrue(Zone.current.inSameErrorZone(z)); - return; + return; } Expect.fail("Zone.current.parent is null"); } @@ -25,7 +25,7 @@ diff() { Zone? z = Zone.current.parent; if (z != null) { Expect.isFalse(Zone.current.inSameErrorZone(z)); - return; + return; } } diff --git a/LibTest/async/Zone/inSameErrorZone_A01_t04.dart b/LibTest/async/Zone/inSameErrorZone_A01_t04.dart index a3d98570b4..31511f57b2 100644 --- a/LibTest/async/Zone/inSameErrorZone_A01_t04.dart +++ b/LibTest/async/Zone/inSameErrorZone_A01_t04.dart @@ -16,7 +16,7 @@ same() { Zone? z = Zone.current.parent; if (z != null) { Expect.isTrue(Zone.current.inSameErrorZone(z)); - return; + return; } Expect.fail("Zone.current.parent is null"); } @@ -25,7 +25,7 @@ diff() { Zone? z = Zone.current.parent; if (z != null) { Expect.isFalse(Zone.current.inSameErrorZone(z)); - return; + return; } } diff --git a/LibTest/async/Zone/inSameErrorZone_A01_t05.dart b/LibTest/async/Zone/inSameErrorZone_A01_t05.dart index 3c8f6dd0d8..eecd64756c 100644 --- a/LibTest/async/Zone/inSameErrorZone_A01_t05.dart +++ b/LibTest/async/Zone/inSameErrorZone_A01_t05.dart @@ -16,7 +16,7 @@ same() { Zone? z = Zone.current.parent; if (z != null) { Expect.isTrue(Zone.current.inSameErrorZone(z)); - return; + return; } Expect.fail("Zone.current.parent is null"); } @@ -25,9 +25,10 @@ diff() { Zone? z = Zone.current.parent; if (z != null) { Expect.isFalse(Zone.current.inSameErrorZone(z)); - return; + return; } } + main() { runZonedGuarded(() { asyncStart(); @@ -39,7 +40,7 @@ main() { // catchError is registered in different error zone // error is not caught by catchError, neither by this error zone handler f.catchError((_) { - Expect.fail('Future completed with unexpected error'); + Expect.fail('Future completed with unexpected error'); }); }, (_, __) { Expect.fail('Unexpected error in runZonedGuarded call'); diff --git a/LibTest/async/Zone/operator_subscript_A01_t01.dart b/LibTest/async/Zone/operator_subscript_A01_t01.dart index ee93158b93..0d76fa4faa 100644 --- a/LibTest/async/Zone/operator_subscript_A01_t01.dart +++ b/LibTest/async/Zone/operator_subscript_A01_t01.dart @@ -4,7 +4,7 @@ /// @assertion abstract dynamic operator [](Symbol key) /// Retrieves the zone-value associated with key. -/// If this zone does not contain the value looks up the same key in the +/// If this zone does not contain the value looks up the same key in the /// parent zone. If the key is not found returns null. /// @description Check that operator[] returns expected values. /// @author ilya @@ -13,10 +13,10 @@ import "dart:async"; import "../../../Utils/expect.dart"; main() { - Zone.current.fork(zoneValues: {#a:1, #b:2}).run(() { + Zone.current.fork(zoneValues: {#a: 1, #b: 2}).run(() { Expect.equals(1, Zone.current[#a]); Expect.equals(2, Zone.current[#b]); - Zone.current.fork(zoneValues: {#a:11}).run(() { + Zone.current.fork(zoneValues: {#a: 11}).run(() { Expect.equals(11, Zone.current[#a]); Expect.equals(2, Zone.current[#b]); Expect.equals(1, Zone.current.parent![#a]); diff --git a/LibTest/async/Zone/registerBinaryCallback_A01_t01.dart b/LibTest/async/Zone/registerBinaryCallback_A01_t01.dart index 894a588d18..c24d89e108 100644 --- a/LibTest/async/Zone/registerBinaryCallback_A01_t01.dart +++ b/LibTest/async/Zone/registerBinaryCallback_A01_t01.dart @@ -25,24 +25,26 @@ main() { int f(int x, int y) => x + y; ZoneBinaryCallback callback = - z.registerBinaryCallback(f); + z.registerBinaryCallback(f); Expect.isTrue(callback is ZoneBinaryCallback); Expect.runtimeIsType>(callback); Expect.equals(3, callback(1, 2)); ZoneBinaryCallback registerFunction( - Zone self, ZoneDelegate parent, Zone zone,R f(T1 arg1, T2 arg2)) { + Zone self, ZoneDelegate parent, Zone zone, R f(T1 arg1, T2 arg2)) { return (_, __) => 42 as R; } - z.fork(specification: new ZoneSpecification( - registerBinaryCallback: registerFunction)) + z + .fork( + specification: + new ZoneSpecification(registerBinaryCallback: registerFunction)) .run(() { - ZoneBinaryCallback callback = - Zone.current.registerBinaryCallback(f); - Expect.isTrue(callback is ZoneBinaryCallback); - Expect.runtimeIsType>(callback); - Expect.equals(42, callback(1, 2)); - }); + ZoneBinaryCallback callback = + Zone.current.registerBinaryCallback(f); + Expect.isTrue(callback is ZoneBinaryCallback); + Expect.runtimeIsType>(callback); + Expect.equals(42, callback(1, 2)); + }); } diff --git a/LibTest/async/Zone/registerCallback_A01_t01.dart b/LibTest/async/Zone/registerCallback_A01_t01.dart index b71160aace..a454122ec4 100644 --- a/LibTest/async/Zone/registerCallback_A01_t01.dart +++ b/LibTest/async/Zone/registerCallback_A01_t01.dart @@ -28,15 +28,19 @@ main() { Expect.runtimeIsType>(callback); Expect.equals(0, callback()); - ZoneCallback registerFunction(Zone self, ZoneDelegate parent, Zone zone, R f()) { + ZoneCallback registerFunction( + Zone self, ZoneDelegate parent, Zone zone, R f()) { return () => 42 as R; } - z.fork(specification: new ZoneSpecification(registerCallback: registerFunction)) + z + .fork( + specification: + new ZoneSpecification(registerCallback: registerFunction)) .run(() { - ZoneCallback callback = Zone.current.registerCallback(f); - Expect.isTrue(callback is ZoneCallback); - Expect.runtimeIsType>(callback); - Expect.equals(42, callback()); - }); + ZoneCallback callback = Zone.current.registerCallback(f); + Expect.isTrue(callback is ZoneCallback); + Expect.runtimeIsType>(callback); + Expect.equals(42, callback()); + }); } diff --git a/LibTest/async/Zone/registerUnaryCallback_A01_t01.dart b/LibTest/async/Zone/registerUnaryCallback_A01_t01.dart index cc25091051..9b852097c2 100644 --- a/LibTest/async/Zone/registerUnaryCallback_A01_t01.dart +++ b/LibTest/async/Zone/registerUnaryCallback_A01_t01.dart @@ -24,22 +24,26 @@ main() { int f(int x) => x; - ZoneUnaryCallback callback = z.registerUnaryCallback(f); + ZoneUnaryCallback callback = z.registerUnaryCallback(f); Expect.isTrue(callback is ZoneUnaryCallback); Expect.runtimeIsType>(callback); Expect.equals(1, callback(1)); ZoneUnaryCallback registerFunction( - Zone self, ZoneDelegate parent, Zone zone, f(T arg)){ + Zone self, ZoneDelegate parent, Zone zone, f(T arg)) { return (_) => 42 as R; } - z.fork(specification: new ZoneSpecification(registerUnaryCallback:registerFunction)) + z + .fork( + specification: + new ZoneSpecification(registerUnaryCallback: registerFunction)) .run(() { - ZoneUnaryCallback callback = Zone.current.registerUnaryCallback(f); - Expect.isTrue(callback is ZoneUnaryCallback); - Expect.runtimeIsType>(callback); - Expect.equals(42, callback(1)); - }); + ZoneUnaryCallback callback = + Zone.current.registerUnaryCallback(f); + Expect.isTrue(callback is ZoneUnaryCallback); + Expect.runtimeIsType>(callback); + Expect.equals(42, callback(1)); + }); } diff --git a/LibTest/async/Zone/runBinaryGuarded_A01_t02.dart b/LibTest/async/Zone/runBinaryGuarded_A01_t02.dart index 0355999265..e62389212e 100644 --- a/LibTest/async/Zone/runBinaryGuarded_A01_t02.dart +++ b/LibTest/async/Zone/runBinaryGuarded_A01_t02.dart @@ -26,11 +26,8 @@ main() { caughtError = e; } - Zone zone = Zone.current.fork( - specification: new ZoneSpecification( - handleUncaughtError: handler - ) - ); + Zone zone = Zone.current + .fork(specification: new ZoneSpecification(handleUncaughtError: handler)); void action(int x, String y) { throw "action error"; diff --git a/LibTest/async/Zone/runBinary_A01_t01.dart b/LibTest/async/Zone/runBinary_A01_t01.dart index 49a0774075..75ab679ddb 100644 --- a/LibTest/async/Zone/runBinary_A01_t01.dart +++ b/LibTest/async/Zone/runBinary_A01_t01.dart @@ -18,14 +18,10 @@ import "dart:async"; import "../../../Utils/expect.dart"; void test(Zone zone) { - int result = zone.runBinary( - (int x, String y) { - Expect.equals(zone, Zone.current); - return x + int.parse(y); - }, - 1, - "2" - ); + int result = zone.runBinary((int x, String y) { + Expect.equals(zone, Zone.current); + return x + int.parse(y); + }, 1, "2"); Expect.equals(3, result); } diff --git a/LibTest/async/Zone/runBinary_A01_t02.dart b/LibTest/async/Zone/runBinary_A01_t02.dart index 4345bca69b..403316ad8f 100644 --- a/LibTest/async/Zone/runBinary_A01_t02.dart +++ b/LibTest/async/Zone/runBinary_A01_t02.dart @@ -24,19 +24,14 @@ main() { handlerCallCount++; } - Zone zone = Zone.current.fork( - specification: new ZoneSpecification( - handleUncaughtError: handler - ) - ); + Zone zone = Zone.current + .fork(specification: new ZoneSpecification(handleUncaughtError: handler)); int action(int x, String y) { throw "action error"; } - Expect.throws( - () => zone.runBinary(action, 1, "2"), - (e) => e=="action error" - ); + Expect.throws(() => zone.runBinary(action, 1, "2"), + (e) => e == "action error"); Expect.equals(0, handlerCallCount); } diff --git a/LibTest/async/Zone/runGuarded_A01_t02.dart b/LibTest/async/Zone/runGuarded_A01_t02.dart index a2285d92a3..8cce9e8fae 100644 --- a/LibTest/async/Zone/runGuarded_A01_t02.dart +++ b/LibTest/async/Zone/runGuarded_A01_t02.dart @@ -27,11 +27,8 @@ main() { caughtError = e; } - Zone zone = Zone.current.fork( - specification: new ZoneSpecification( - handleUncaughtError: handler - ) - ); + Zone zone = Zone.current + .fork(specification: new ZoneSpecification(handleUncaughtError: handler)); void action() { throw "action error"; diff --git a/LibTest/async/Zone/runUnaryGuarded_A01_t02.dart b/LibTest/async/Zone/runUnaryGuarded_A01_t02.dart index 918e058e54..a439ed222e 100644 --- a/LibTest/async/Zone/runUnaryGuarded_A01_t02.dart +++ b/LibTest/async/Zone/runUnaryGuarded_A01_t02.dart @@ -22,11 +22,8 @@ main() { caughtError = e; } - Zone zone = Zone.current.fork( - specification: new ZoneSpecification( - handleUncaughtError: handler - ) - ); + Zone zone = Zone.current + .fork(specification: new ZoneSpecification(handleUncaughtError: handler)); void action(int x) { throw "action error"; diff --git a/LibTest/async/Zone/runUnary_A01_t01.dart b/LibTest/async/Zone/runUnary_A01_t01.dart index 4f9eb1ecfc..b326be9ee8 100644 --- a/LibTest/async/Zone/runUnary_A01_t01.dart +++ b/LibTest/async/Zone/runUnary_A01_t01.dart @@ -12,13 +12,10 @@ import "dart:async"; import "../../../Utils/expect.dart"; void test(Zone zone) { - int result = zone.runUnary( - (int x) { - Expect.equals(zone, Zone.current); - return x; - }, - 1 - ); + int result = zone.runUnary((int x) { + Expect.equals(zone, Zone.current); + return x; + }, 1); Expect.equals(1, result); } diff --git a/LibTest/async/Zone/run_A01_t02.dart b/LibTest/async/Zone/run_A01_t02.dart index 76e4693db9..c80bba27d9 100644 --- a/LibTest/async/Zone/run_A01_t02.dart +++ b/LibTest/async/Zone/run_A01_t02.dart @@ -25,16 +25,13 @@ main() { handlerCallCount++; } - Zone zone = Zone.current.fork( - specification: new ZoneSpecification( - handleUncaughtError: handler - ) - ); + Zone zone = Zone.current + .fork(specification: new ZoneSpecification(handleUncaughtError: handler)); int action() { throw "action error"; } - Expect.throws(() => zone.run(action), (e) => e=="action error"); + Expect.throws(() => zone.run(action), (e) => e == "action error"); Expect.equals(0, handlerCallCount); }