dart-sdk/pkg/test_runner
Robert Nystrom fdb6ca6d01 Add support for context messages to static error tests.
Currently only CFE ("Fasta") tests have their context message output
parsed. It should be easy to extend that to dart2js and DDC if that's
useful. Analyzer might be more work.

This also adds support to the test updater for inserting context
messages when updating tests. By default, that flag is off, so the
existing behavior is preserved where context messages are ignnored. If
you want them, pass "-c" when updating a test.

When validating test output, if the test file contains context messages,
then they are validated. Otherwise, any context messages in the CFE
output are ignored. This way existing tests still pass.


Change StaticError to represent a single error for a single front end.

Before, the data model collapsed errors for different front-ends at the
same location into a single StaticError object which tracked different
messages for each front end. The idea was to move towards a world where
they really are the "same" error with eventually the same message.

But this adds a lot of complexity with things like merging errors and
doesn't reflect the reality that each error from each front end is
basically its own thing. Also, critically, it makes it much harder to
attach context messages to a specific front end's error object.

This changes it so that an instance of StaticError represents a single
error for a single front end. The test file syntax is unchanged and the
updated tool behaves the same. In a static error test, multiple
expectations can still share the same "//   ^^^" marker line. They are
just expanded to multiple StaticError objects at parse time.

This eliminates all of the complexity around merging and simplifying
errors.

Change-Id: Ida1736bfcde436fc2d1ce2963d91fa9cb154afa8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193281
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2021-03-30 18:41:21 +00:00
..
bin Don't crash on --help, --find-configurations, or --list-configurations. 2021-03-30 00:20:54 +00:00
lib Add support for context messages to static error tests. 2021-03-30 18:41:21 +00:00
test Add support for context messages to static error tests. 2021-03-30 18:41:21 +00:00
tool Add support for context messages to static error tests. 2021-03-30 18:41:21 +00:00
.gitignore
analysis_options.yaml Turn on the "isEmpty" and "isNotEmpty" lints and fix violations. 2020-08-31 18:33:48 +00:00
pubspec.yaml Reland "Reland "update Glob in the sdk, also adds package:file to the sdk"" 2020-11-30 21:58:44 +00:00