dart-sdk/tests/language/function
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
..
apply_generic2_test.dart [expect] introduce Expect.throwsWhen and Expect.throwsTypeErrorWhen 2024-02-14 20:12:05 +00:00
apply_generic_test.dart
argument_test.dart
call_generic_test.dart [cfe] Infer Object from constraints similar to T? = dynamic 2020-09-16 11:36:28 +00:00
field_test.dart
function_test.dart
getter_test.dart
literals2_test.dart
literals_test.dart
local2_test.dart
local3_test.dart
local_function_test.dart
malformed_result_type_runtime_test.dart
malformed_result_type_test.dart
propagation_test.dart
regress_45601_test.dart [ddc] Fix equality tests for Functions 2021-04-15 22:02:07 +00:00
syntax_test.dart
type2_test.dart [expect] introduce Expect.throwsWhen and Expect.throwsTypeErrorWhen 2024-02-14 20:12:05 +00:00
type3_test.dart
type_alias2_test.dart
type_alias3_test.dart
type_alias4_test.dart Spelling tests language 2022-12-19 16:30:06 +00:00
type_alias5_test.dart
type_alias6_runtime_test.dart
type_alias6_test.dart Issue 46062. Report TYPE_ALIAS_CANNOT_REFERENCE_ITSELF on the name of the alias. 2021-05-19 15:45:21 +00:00
type_alias7_test.dart Remove uses of : as default value separator in some tests/ directories. 2022-09-07 14:49:17 +00:00
type_alias8_test.dart
type_alias9_runtime_test.dart
type_alias9_test.dart [cfe] Check for cyclic typedefs at declare site instead of use site 2023-12-06 16:11:42 +00:00
type_alias10_test.dart
type_alias_test.dart
type_call_getter2_runtime_test.dart [expect] introduce Expect.throwsWhen and Expect.throwsTypeErrorWhen 2024-02-14 20:12:05 +00:00
type_call_getter2_test.dart
type_call_getter_test.dart
type_in_constant_test.dart
type_parameter2_test.dart
type_parameter3_test.dart
type_parameter_bound_object_test.dart
type_parameter_test.dart
type_test.dart [expect] introduce Expect.throwsWhen and Expect.throwsTypeErrorWhen 2024-02-14 20:12:05 +00:00
type_this_parameter_test.dart