Skip to content

Commit

Permalink
#2119. Remove unsupported element from Stream.first/lastWhere tests d…
Browse files Browse the repository at this point in the history
…escription (#2540)
  • Loading branch information
sgrekhov committed Feb 13, 2024
1 parent 90c6230 commit 1e2e66f
Show file tree
Hide file tree
Showing 16 changed files with 177 additions and 151 deletions.
2 changes: 1 addition & 1 deletion LibTest/async/Stream/allTests_A01.lib.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ import "last_A01_t01.test.dart" as last_A01_t01;
import "last_A02_t01.test.dart" as last_A02_t01;

import "lastWhere_A01_t01.test.dart" as lastWhere_A01_t01;
import "lastWhere_A01_t01.test.dart" as lastWhere_A01_t02;
import "lastWhere_A01_t02.test.dart" as lastWhere_A01_t02;
import "lastWhere_A02_t01.test.dart" as lastWhere_A02_t01;
import "lastWhere_A04_t01.test.dart" as lastWhere_A04_t01;
import "lastWhere_A05_t01.test.dart" as lastWhere_A05_t01;
Expand Down
20 changes: 9 additions & 11 deletions LibTest/async/Stream/firstWhere_A01_t01.test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// @assertion Future<T> firstWhere (
/// bool test(T element), {@deprecated dynamic defaultValue(), T orElse()})
/// @assertion Future<T> firstWhere (bool test(T element), T orElse()})
///
/// Finds the first element of this stream matching test.
///
/// Returns a future that is completed with the first element of this stream that
/// test returns true for.
/// Returns a future that is completed with the first element of this stream for
/// which test returns true.
///
/// If no such element is found before this stream is done, and a orElse function
/// is provided, the result of calling orElse becomes the value of the future. If
/// orElse throws, the returned future is completed with that error.
/// If no such element is found before this stream is done, and an orElse
/// function is provided, the result of calling orElse becomes the value of the
/// future. If orElse throws, the returned future is completed with that error.
///
/// If this stream emits an error before the first matching element, the returned
/// future is completed with that error, and processing stops.
/// If this stream emits an error before the first matching element, the
/// returned future is completed with that error, and processing stops.
///
/// Stops listening to the stream after the first matching element or error has
/// Stops listening to this stream after the first matching element or error has
/// been received.
///
/// Internally the method cancels its subscription after the first element that
Expand All @@ -27,7 +26,6 @@
/// If an error occurs, or if this stream ends without finding a match and with
/// no orElse function provided, the returned future is completed with an error.
///
/// The defaultValue parameter is deprecated, and orElse should be used instead.
/// @description Checks that if element is found, it is passed to the resulting
/// future. [orElse] is omitted.
/// @author kaigorodov
Expand Down
20 changes: 9 additions & 11 deletions LibTest/async/Stream/firstWhere_A01_t02.test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// @assertion Future<T> firstWhere (
/// bool test(T element), {@deprecated dynamic defaultValue(), T orElse()})
/// @assertion Future<T> firstWhere (bool test(T element), T orElse()})
///
/// Finds the first element of this stream matching test.
///
/// Returns a future that is completed with the first element of this stream that
/// test returns true for.
/// Returns a future that is completed with the first element of this stream for
/// which test returns true.
///
/// If no such element is found before this stream is done, and a orElse function
/// is provided, the result of calling orElse becomes the value of the future. If
/// orElse throws, the returned future is completed with that error.
/// If no such element is found before this stream is done, and an orElse
/// function is provided, the result of calling orElse becomes the value of the
/// future. If orElse throws, the returned future is completed with that error.
///
/// If this stream emits an error before the first matching element, the returned
/// future is completed with that error, and processing stops.
/// If this stream emits an error before the first matching element, the
/// returned future is completed with that error, and processing stops.
///
/// Stops listening to the stream after the first matching element or error has
/// Stops listening to this stream after the first matching element or error has
/// been received.
///
/// Internally the method cancels its subscription after the first element that
Expand All @@ -27,7 +26,6 @@
/// If an error occurs, or if this stream ends without finding a match and with
/// no orElse function provided, the returned future is completed with an error.
///
/// The defaultValue parameter is deprecated, and orElse should be used instead.
/// @description Checks that if element is found, it is passed to the resulting
/// future. [orElse] is provided.
/// @author kaigorodov
Expand Down
22 changes: 10 additions & 12 deletions LibTest/async/Stream/firstWhere_A02_t01.test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// @assertion Future<T> firstWhere (
/// bool test(T element), {@deprecated dynamic defaultValue(), T orElse()})
/// @assertion Future<T> firstWhere (bool test(T element), T orElse()})
///
/// Finds the first element of this stream matching test.
///
/// Returns a future that is completed with the first element of this stream that
/// test returns true for.
/// Returns a future that is completed with the first element of this stream for
/// which test returns true.
///
/// If no such element is found before this stream is done, and a orElse function
/// is provided, the result of calling orElse becomes the value of the future. If
/// orElse throws, the returned future is completed with that error.
/// If no such element is found before this stream is done, and an orElse
/// function is provided, the result of calling orElse becomes the value of the
/// future. If orElse throws, the returned future is completed with that error.
///
/// If this stream emits an error before the first matching element, the returned
/// future is completed with that error, and processing stops.
/// If this stream emits an error before the first matching element, the
/// returned future is completed with that error, and processing stops.
///
/// Stops listening to the stream after the first matching element or error has
/// Stops listening to this stream after the first matching element or error has
/// been received.
///
/// Internally the method cancels its subscription after the first element that
Expand All @@ -27,9 +26,8 @@
/// If an error occurs, or if this stream ends without finding a match and with
/// no orElse function provided, the returned future is completed with an error.
///
/// The defaultValue parameter is deprecated, and orElse should be used instead.
/// @description Checks that if this stream ends without finding a match and an
/// orElse function is provided, then the result of calling orElse becomes
/// [orElse] function is provided, then the result of calling [orElse] becomes
/// the value of the future.
/// @author kaigorodov
Expand Down
12 changes: 5 additions & 7 deletions LibTest/async/Stream/firstWhere_A03_t01.test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// @assertion Future<T> firstWhere (
/// bool test(T element), {@deprecated dynamic defaultValue(), T orElse()})
/// @assertion Future<T> firstWhere (bool test(T element), T orElse()})
///
/// Finds the first element of this stream matching test.
///
/// Returns a future that is completed with the first element of this stream
/// that test returns true for.
/// Returns a future that is completed with the first element of this stream for
/// which test returns true.
///
/// If no such element is found before this stream is done, and a orElse
/// If no such element is found before this stream is done, and an orElse
/// function is provided, the result of calling orElse becomes the value of the
/// future. If orElse throws, the returned future is completed with that error.
///
/// If this stream emits an error before the first matching element, the
/// returned future is completed with that error, and processing stops.
///
/// Stops listening to the stream after the first matching element or error has
/// Stops listening to this stream after the first matching element or error has
/// been received.
///
/// Internally the method cancels its subscription after the first element that
Expand All @@ -27,7 +26,6 @@
/// If an error occurs, or if this stream ends without finding a match and with
/// no orElse function provided, the returned future is completed with an error.
///
/// The defaultValue parameter is deprecated, and orElse should be used instead.
/// @description Checks that if an error occurs in the stream, the future
/// will receive an error.
/// @author kaigorodov
Expand Down
24 changes: 11 additions & 13 deletions LibTest/async/Stream/firstWhere_A03_t02.test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// @assertion Future<T> firstWhere (
/// bool test(T element), {@deprecated dynamic defaultValue(), T orElse()})
/// @assertion Future<T> firstWhere (bool test(T element), T orElse()})
///
/// Finds the first element of this stream matching test.
///
/// Returns a future that is completed with the first element of this stream that
/// test returns true for.
/// Returns a future that is completed with the first element of this stream for
/// which test returns true.
///
/// If no such element is found before this stream is done, and a orElse function
/// is provided, the result of calling orElse becomes the value of the future. If
/// orElse throws, the returned future is completed with that error.
/// If no such element is found before this stream is done, and an orElse
/// function is provided, the result of calling orElse becomes the value of the
/// future. If orElse throws, the returned future is completed with that error.
///
/// If this stream emits an error before the first matching element, the returned
/// future is completed with that error, and processing stops.
/// If this stream emits an error before the first matching element, the
/// returned future is completed with that error, and processing stops.
///
/// Stops listening to the stream after the first matching element or error has
/// Stops listening to this stream after the first matching element or error has
/// been received.
///
/// Internally the method cancels its subscription after the first element that
Expand All @@ -27,9 +26,8 @@
/// If an error occurs, or if this stream ends without finding a match and with
/// no orElse function provided, the returned future is completed with an error.
///
/// The defaultValue parameter is deprecated, and orElse should be used instead.
/// @description Checks that if this stream ends without finding a match and with
/// no orElse function provided, the future will receive an error.
/// @description Checks that if this stream ends without finding a match and
/// with no [orElse] function provided, the future will receive an error.
/// @author kaigorodov
library firstWhere_A03_t02;
Expand Down
24 changes: 11 additions & 13 deletions LibTest/async/Stream/firstWhere_A03_t03.test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// @assertion Future<T> firstWhere (
/// bool test(T element), {@deprecated dynamic defaultValue(), T orElse()})
/// @assertion Future<T> firstWhere (bool test(T element), T orElse()})
///
/// Finds the first element of this stream matching test.
///
/// Returns a future that is completed with the first element of this stream that
/// test returns true for.
/// Returns a future that is completed with the first element of this stream for
/// which test returns true.
///
/// If no such element is found before this stream is done, and a orElse function
/// is provided, the result of calling orElse becomes the value of the future. If
/// orElse throws, the returned future is completed with that error.
/// If no such element is found before this stream is done, and an orElse
/// function is provided, the result of calling orElse becomes the value of the
/// future. If orElse throws, the returned future is completed with that error.
///
/// If this stream emits an error before the first matching element, the returned
/// future is completed with that error, and processing stops.
/// If this stream emits an error before the first matching element, the
/// returned future is completed with that error, and processing stops.
///
/// Stops listening to the stream after the first matching element or error has
/// Stops listening to this stream after the first matching element or error has
/// been received.
///
/// Internally the method cancels its subscription after the first element that
Expand All @@ -27,9 +26,8 @@
/// If an error occurs, or if this stream ends without finding a match and with
/// no orElse function provided, the returned future is completed with an error.
///
/// The defaultValue parameter is deprecated, and orElse should be used instead.
/// @description Checks that if an [test] throws error, the future
/// will be completed with that error.
/// @description Checks that if an [test] throws error, the future is completed
/// with that error.
/// @author kaigorodov
library firstWhere_A03_t03;
Expand Down
22 changes: 10 additions & 12 deletions LibTest/async/Stream/firstWhere_A03_t04.test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// @assertion Future<T> firstWhere (
/// bool test(T element), {@deprecated dynamic defaultValue(), T orElse()})
/// @assertion Future<T> firstWhere (bool test(T element), T orElse()})
///
/// Finds the first element of this stream matching test.
///
/// Returns a future that is completed with the first element of this stream that
/// test returns true for.
/// Returns a future that is completed with the first element of this stream for
/// which test returns true.
///
/// If no such element is found before this stream is done, and a orElse function
/// is provided, the result of calling orElse becomes the value of the future. If
/// orElse throws, the returned future is completed with that error.
/// If no such element is found before this stream is done, and an orElse
/// function is provided, the result of calling orElse becomes the value of the
/// future. If orElse throws, the returned future is completed with that error.
///
/// If this stream emits an error before the first matching element, the returned
/// future is completed with that error, and processing stops.
/// If this stream emits an error before the first matching element, the
/// returned future is completed with that error, and processing stops.
///
/// Stops listening to the stream after the first matching element or error has
/// Stops listening to this stream after the first matching element or error has
/// been received.
///
/// Internally the method cancels its subscription after the first element that
Expand All @@ -27,9 +26,8 @@
/// If an error occurs, or if this stream ends without finding a match and with
/// no orElse function provided, the returned future is completed with an error.
///
/// The defaultValue parameter is deprecated, and orElse should be used instead.
/// @description Checks that if this stream ends without finding a match and
/// orElse function throws error, the future will receive that error.
/// [orElse] function throws error, the future will receive that error.
/// @author a.semenov@unipro.ru
library firstWhere_A03_t04;
Expand Down
20 changes: 9 additions & 11 deletions LibTest/async/Stream/firstWhere_A04_t01.test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// @assertion Future<T> firstWhere (
/// bool test(T element), {@deprecated dynamic defaultValue(), T orElse()})
/// @assertion Future<T> firstWhere (bool test(T element), T orElse()})
///
/// Finds the first element of this stream matching test.
///
/// Returns a future that is completed with the first element of this stream that
/// test returns true for.
/// Returns a future that is completed with the first element of this stream for
/// which test returns true.
///
/// If no such element is found before this stream is done, and a orElse function
/// is provided, the result of calling orElse becomes the value of the future. If
/// orElse throws, the returned future is completed with that error.
/// If no such element is found before this stream is done, and an orElse
/// function is provided, the result of calling orElse becomes the value of the
/// future. If orElse throws, the returned future is completed with that error.
///
/// If this stream emits an error before the first matching element, the returned
/// future is completed with that error, and processing stops.
/// If this stream emits an error before the first matching element, the
/// returned future is completed with that error, and processing stops.
///
/// Stops listening to the stream after the first matching element or error has
/// Stops listening to this stream after the first matching element or error has
/// been received.
///
/// Internally the method cancels its subscription after the first element that
Expand All @@ -27,7 +26,6 @@
/// If an error occurs, or if this stream ends without finding a match and with
/// no orElse function provided, the returned future is completed with an error.
///
/// The defaultValue parameter is deprecated, and orElse should be used instead.
/// @description Checks that non broadcast stream can not be listened after
/// the first element is returned.
/// @author a.semenov@unipro.ru
Expand Down
22 changes: 14 additions & 8 deletions LibTest/async/Stream/lastWhere_A01_t01.test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,25 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// @assertion Future<T> lastWhere (bool test(T element),
/// {@deprecated dynamic defaultValue(), T orElse()})
/// @assertion Future<T> lastWhere(bool test(T element), {T orElse()?})
///
/// Finds the last element in this stream matching test.
///
/// If this stream emits an error, the returned future is completed with that
/// error, and processing stops.
/// Returns a future that is completed with the last element of this stream for
/// which test returns true.
///
/// Otherwise as firstWhere, except that the last matching element is found
/// instead of the first. That means that a non-error result cannot be provided
/// before this stream is done.
/// If no such element is found before this stream is done, and an orElse
/// function is provided, the result of calling orElse becomes the value of the
/// future. If orElse throws, the returned future is completed with that error.
///
/// If this stream emits an error at any point, the returned future is completed
/// with that error, and the subscription is canceled.
///
/// A non-error result cannot be provided before this stream is done.
///
/// Similar too firstWhere, except that the last matching element is found
/// instead of the first.
///
/// The defaultValue parameter is deprecated, and orElse should be used instead.
/// @description Checks that if element is found, it is passed to the resulting
/// future. [orElse] is omitted.
/// @author a.semenov@unipro.ru
Expand Down

0 comments on commit 1e2e66f

Please sign in to comment.