Description
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.