Skip to content

Test precisely for specific compile-time errors and their source positions #36766

Closed
@whesse

Description

@whesse

Meta-issue to discuss and implement more precise testing for compile-time errors.

Testing for compile-time errors using test.py mainly uses multitests, since they have a way of specifying that the expected result of running a test will be a compile-time failure, and they allow
testing for multiple cases of compile failures in a single test files.

What is missing in test.py's evaluation of the result of running a (multi)test, is a check that the compile-time error is the expected error, and that it occurs at the right source code position in the (multi)test.

If there is a standard for specifying the expected error, and its position, in the test source, and standards for how our various compilers and parsers report these errors, then we can put the logic for checking that the result of a test matches the expectation, including the error type and position, into the test.py (tools/testing/dart) test framework.

We could also consider putting it into other testing frameworks, like package:test and package:testing.

I will start a checklist of the topics we need to consider, and we can create related issues for
the subtopics as we flesh them out. General comments on the topic should be posted as replies, or written in a document.

  • Standard way of marking compile-time errors with their type and position
  • Standardizing the way that our tools report these errors, so that test.py can have simpler code to check for them
  • Creating new multitests for static errors using this new syntax, while remaining compatible with existing tests that are unchanged.

@munificent @jcollins-g @sigmundch @whesse

Metadata

Metadata

Assignees

Labels

area-infrastructureUse area-infrastructure for SDK infrastructure issues, like continuous integration bot changes.area-testCross-cutting test issues (use area- labels for specific failures; not used for package:test).type-enhancementA request for a change that isn't a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions