Repository: flutter/flutter
File: dev/bots/test/analyze_test.dart (Dart)

Code before:
  test('matchesErrorsInFile matcher basic test', () async {
    final String result = await capture(() async {
      foundError(<String>[
        'meta.dart:5: error #1',
        'meta.dart:5: error #2',
        'meta.dart:6: error #3',
        '',
        'Error summary',
      ]);
    }, shouldHaveErrors: true);
    final fixture = File(path.join(testRootPath, 'packages', 'foo', 'meta.dart'));
    expect(result, matchesErrorsInFile(fixture, endsWith: <String>['', 'Error summary']));
  });

  test('analyze.dart - verifyDeprecations', () async {
    final String result = await capture(
      () => verifyDeprecations(testRootPath, minimumMatches: 2),
      shouldHaveErrors: true,
    );
    final fixture = File(path.join(testRootPath, 'packages', 'foo', 'deprecation.dart'));
    expect(
      result,
      matchesErrorsInFile(
        fixture,
        endsWith: <String>[
          'Deprecation notice must end with a line saying "This feature was deprecated after v<version> ...".',
          'See: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes',
        ],
      ),
    );
  });

  test('analyze.dart - verifyGoldenTags', () async {
    final List<String> result = (await capture(
      () => verifyGoldenTags(testRootPath, minimumMatches: 6),
      shouldHaveErrors: true,
    )).split('\n');
    const noTag =
        "Files containing golden tests must be tagged using @Tags(<String>['reduced-test-set']) "
        'at the top of the file before import statements.';
    const missingTag = "Files containing golden tests must be tagged with 'reduced-test-set'.";
    final List<String> lines = <String>[
      '║ test/analyze-test-input/root/packages/foo/golden_missing_tag.dart: $missingTag',
      '║ test/analyze-test-input/root/packages/foo/golden_no_tag.dart: $noTag',
    ].map((String line) => line.replaceAll('/', Platform.isWindows ? r'\' : '/')).toList();
    expect(
      result.length,
      4 + lines.length,
      reason: 'output had unexpected number of lines:\n${result.join('\n')}',
    );
    expect(

Review comment (bug):
Apologies, it looks like this is not the right way to test it, because I didn't yet understand the test :(

This test makes use of a fixture file to define the deprecation message tests. The `endsWith` argument here _builds on top of that_. So instead of modifying this file, you need to add a test case in the fixture file at `dev/bots/test/analyze-test-input/root/packages/foo/deprecation.dart`.

You can apply the following git patch to update the fixture file. It updates the `test()` functions, so that the indexes are incremented, and adds some test cases for the fix here. (including the adjustment for the period at the end)

```
diff --git a/dev/bots/test/analyze-test-input/root/packages/foo/deprecation.dart b/dev/bots/test/analyze-test-input/root/packages/foo/deprecation.dart
index cf20a1a6465..252d512c8d6 100644
--- a/dev/bots/test/analyze-test-input/root/packages/foo/deprecation.dart
+++ b/dev/bots/test/analyze-test-input/root/packages/foo/deprecation.dart
@@ -59,39 +59,51 @@ void test9() { }
 )
 void test10() { }
 
+@Deprecated(
+  'Version number test (should fail). '
+  'This feature was deprecated after 1.0.0.' // ERROR: Deprecation notice must end with a line saying "This feature was deprecated after v<version>.".
+)
+void test11() {}
+
+@Deprecated(
+  'Version number test (should fail). '
+  'This feature was deprecated after v1.0.0' // ERROR: Deprecation notice must end with a line saying "This feature was deprecated after v<version>.".
+)
+void test12() {}
+
 @Deprecated(
   'Version number test (special beta should pass). '
   'This feature was deprecated after v3.1.0.'
 )
-void test11() { }
+void test13() { }
 
 @Deprecated(
   'Version number test (should be fine). '
   'This feature was deprecated after v0.1.0.'
 )
-void test12() { }
+void test14() { }
 
 @Deprecated(
   'Version number test (should be fine). '
   'This feature was deprecated after v1.20.0-1.0.pre.'
 )
-void test13() { }
+void test15() { }
 
 @Deprecated(
   "Double quotes' test (should fail). " // ERROR: Deprecation notice does not match required pattern. You might have used double quotes (") for the string instead of single quotes (').
   'This feature was deprecated after v2.1.0-11.0.pre.'
 )
-void test14() { }
+void test16() { }
 
 @Deprecated( // flutter_ignore: deprecation_syntax, https://github.com/flutter/flutter/issues/000000
   'Missing the version line. '
 )
-void test15() { }
+void test17() { }
 // dart format on
 
 // flutter_ignore: deprecation_syntax, https://github.com/flutter/flutter/issues/000000
 @Deprecated('Missing the version line. ')
-void test16() {}
+void test18() {}
 
 class TestClass1 {
   // flutter_ignore: deprecation_syntax, https://github.com/flutter/flutter/issues/000000
```

Code after:
  test('matchesErrorsInFile matcher basic test', () async {
    final String result = await capture(() async {
      foundError(<String>[
        'meta.dart:5: error #1',
        'meta.dart:5: error #2',
        'meta.dart:6: error #3',
        '',
        'Error summary',
      ]);
    }, shouldHaveErrors: true);
    final fixture = File(path.join(testRootPath, 'packages', 'foo', 'meta.dart'));
    expect(result, matchesErrorsInFile(fixture, endsWith: <String>['', 'Error summary']));
  });

  test('analyze.dart - verifyDeprecations', () async {
    final String result = await capture(
      () => verifyDeprecations(testRootPath, minimumMatches: 2),
      shouldHaveErrors: true,
    );
    final fixture = File(path.join(testRootPath, 'packages', 'foo', 'deprecation.dart'));
    expect(
      result,
      matchesErrorsInFile(
        fixture,
        endsWith: <String>[
          'See: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes',
        ],
      ),
    );
  });

  test('analyze.dart - verifyGoldenTags', () async {
    final List<String> result = (await capture(
      () => verifyGoldenTags(testRootPath, minimumMatches: 6),
      shouldHaveErrors: true,
    )).split('\n');
    const noTag =
        "Files containing golden tests must be tagged using @Tags(<String>['reduced-test-set']) "
        'at the top of the file before import statements.';
    const missingTag = "Files containing golden tests must be tagged with 'reduced-test-set'.";
    final List<String> lines = <String>[
      '║ test/analyze-test-input/root/packages/foo/golden_missing_tag.dart: $missingTag',
      '║ test/analyze-test-input/root/packages/foo/golden_no_tag.dart: $noTag',
    ].map((String line) => line.replaceAll('/', Platform.isWindows ? r'\' : '/')).toList();
    expect(
      result.length,
      4 + lines.length,
      reason: 'output had unexpected number of lines:\n${result.join('\n')}',
    );
    expect(
      result[0],