dart-sdk/tests/language/function_subtype
Sigmund Cherem 050afd650f [expect] introduce Expect.throwsWhen and Expect.throwsTypeErrorWhen
Today, most tests that touch on a behavior variation end up
skipping expectations or the entirety of a test for some
testing configurations.  Moving forward, we'd like skip less
and try to account for the behavior variations if that's
reasonable.

This CL shows an approach to improve our test coverage for
behavior variations. We introduce two new methods to
[Expect] that allow us to conditionally check that a
function throws, depending on variation predicates.

The CL changes expectations for errors that don't occur
when dart2js omits parameter type checks or implicit
downcasts.

Note: originally I had the intention to introduce a name
parameter to `Expect.throws` and `Expect.throwsTypeError` to
avoid introducing a new API. However, because these APIs are
used for testing core language features, such as function
parameters themselves, we decided to keep the use of
features in these APIs as simple as it can be.

CoreLibraryReviewExempt: no public library semantic change - only improving test coverage under variations
Change-Id: I531657622655778491eaca8b37ba69ffaab559fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351340
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2024-02-14 20:12:05 +00:00
..
bound_closure0_test.dart
bound_closure1_test.dart
bound_closure2_test.dart
bound_closure3_test.dart
bound_closure4_test.dart
bound_closure5_test.dart
bound_closure5a_test.dart
bound_closure6_test.dart
bound_closure7_test.dart [expect] introduce Expect.throwsWhen and Expect.throwsTypeErrorWhen 2024-02-14 20:12:05 +00:00
call0_test.dart
call1_test.dart
call2_test.dart
call_type_variable_test.dart
cast0_test.dart
cast1_test.dart
cast2_test.dart
cast3_test.dart
checked0_test.dart [expect] introduce Expect.throwsWhen and Expect.throwsTypeErrorWhen 2024-02-14 20:12:05 +00:00
closure0_test.dart
closure1_test.dart
factory0_test.dart
factory1_test.dart
function_subtype0_test.dart
function_subtype1_test.dart
function_subtype2_test.dart
function_subtype3_test.dart
generic_function_type_substitution_test.dart
inline0_test.dart
inline1_test.dart
inline2_test.dart
local0_test.dart
local1_test.dart
local2_test.dart
local3_test.dart
local4_test.dart
local5_test.dart
local6_test.dart
named1_test.dart
named2_test.dart
nested_function_type_test.dart
not0_test.dart
not1_test.dart
not2_test.dart
not3_test.dart
null_test.dart
optional1_test.dart
optional2_test.dart
regress41680_strong_test.dart
regress41680_weak_test.dart
regression_ddc_588_test.dart
setter0_test.dart
simple0_test.dart
simple1_test.dart
simple2_test.dart
top_level0_test.dart
top_level1_test.dart
typearg0_test.dart
typearg1_test.dart
typearg2_test.dart
typearg3_test.dart
typearg5_test.dart