Skip to content

Should we verify the contents of tests whose purpose is encoding or file formats? #53398

Open
@eernstg

Description

@eernstg

The syntax of Dart is specified in such a way that lines can end in \n, \r, or \r\n, which implies that any sequence of \n and \r in any order is accepted as whitespace and henceforth ignored (except that the existence of whitespace is used in one situation to disambiguate an otherwise ambiguous term; but even that doesn't depend on which kind of whitespace it is).

We have a few tests whose purpose is to verify that the tools do indeed accept line endings in source code as specified.

In addition, we also have some tests whose purpose is to test the treatment of string literals (containing UTF-8 text).

With respect to line endings, the tests can be destroyed by running dos2unix or a utility like that, because they won't test anything of interest after being converted. A manual inspection may very well fail to see the difference, because line endings (of any kind) are normally not shown. The situation is similar for other tests containing specialized characters.

Would it be worth the effort to take a sha1sum of such tests, store those sha1 values somewhere (perhaps foo_A01_t01.dart could have its sha1 stored in foo_A01_t01.sha1), and run a presubmit script that checks the sha1 if the corresponding library has been modified?

The approach could also make sense for non-source-code artifacts (images etc.) which are part of a test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-infrastructureUse area-infrastructure for SDK infrastructure issues, like continuous integration bot changes.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions