dart-sdk/tests/language_2/control_flow_collections
Lasse R.H. Nielsen cd0606e425 Simplify asyncExpectThrows and enhance Expect.throws.
For `asyncExpectThrows`, instead of taking a function,
then checking if that function can be called with zero arguments,
and then immediately calling it and checking that it returns a future,
just take the future as argument.

Since synchronus errors from calling the function were not caught
anyway, doing the entire `Future` computation directly shouldn't
change behavior.

Also make `asyncExpectThrows` and `Expect.throws` return the caught error,
so that you can use normal `Expect.something` checks on it afterwards,
instead of doing that in the `check` function.
That basically makes the `check` function unnecessary (but hard to remove
with the existing test corpus using it heavily).

This makes some uses of the `asyncExpectThrows` function slightly more
complicated, those that have no other way to create a future than calling
the argument function anyway, but other uses become simpler
when they can avoid adding the function wrapper.

TEST= Refactoring. If the tests keep running, it's successful.

Change-Id: I983eb65ea4805760339073fabc27f78c57f9a471
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226102
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-01-06 17:06:47 +00:00
..
await_for_inference_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
await_for_null_test.dart Simplify asyncExpectThrows and enhance Expect.throws. 2022-01-06 17:06:47 +00:00
await_for_syntax_error_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
await_for_test.dart Simplify asyncExpectThrows and enhance Expect.throws. 2022-01-06 17:06:47 +00:00
await_for_type_error_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
for_await_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
for_const_error_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
for_inference_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
for_non_bool_condition_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
for_null_condition_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
for_runtime_error_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
for_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
for_variable_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
if_await_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
if_const_error_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
if_const_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
if_inference_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
if_null_condition_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
if_promotion_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
if_runtime_error_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
if_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
map_set_ambiguity_error_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
map_set_ambiguity_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
syntax_error_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
syntax_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
type_error_test.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00
utils.dart Add language versions to _2 test libraries 2021-04-26 17:58:57 +00:00