flutter/dev/bots/test/analyze-test-input/root/packages/foo/deprecation.dart
LongCatIsLooong f6b9f937da
Extract analyze test expectations from test fixture (#161108)
This allows analyze tests to interpret inline comments in a specific
format as error message expectations.
e.g.,:

Adding `// ERROR: this is bad because A, B, C, D` to line 50 in
`file.ext`

would match an error message that looks like `../path/path/file.ext: 50:
this is bad because A, B, C, D`

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-01-07 20:51:24 +00:00

101 lines
3.3 KiB
Dart

// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@Deprecated(
'This is the reason and what you should use instead. '
'This feature was deprecated after v1.2.3.',
)
void test1() {}
// The code below is intentionally miss-formatted for testing.
// dart format off
@Deprecated(
'bad grammar. ' // ERROR: Deprecation notice should be a grammatically correct sentence and start with a capital letter; see style guide: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
'This feature was deprecated after v1.2.3.'
)
void test2() { }
@Deprecated(
'Also bad grammar ' // ERROR: Deprecation notice should be a grammatically correct sentence and end with a period; notice appears to be "Also bad grammar".
'This feature was deprecated after v1.2.3.'
)
void test3() { }
@Deprecated('Not the right syntax. This feature was deprecated after v1.2.3.') // ERROR: Deprecation notice must be an adjacent string.
void test4() { }
@Deprecated( // ERROR: Deprecation notice must be an adjacent string.
'Missing the version line. '
)
void test5() { }
@Deprecated( // ERROR: Deprecation notice must be an adjacent string.
'This feature was deprecated after v1.2.3.'
)
void test6() { }
@Deprecated(
'URLs are not required. '
'This feature was deprecated after v1.0.0.'
)
void test7() { }
@Deprecated(
'Version number test (should pass). '
'This feature was deprecated after v1.19.0.'
)
void test8() { }
@Deprecated(
'Version number test (should fail). '
'This feature was deprecated after v1.20.0.' // ERROR: Deprecation notice does not accurately indicate a beta branch version number; please see https://flutter.dev/docs/development/tools/sdk/releases to find the latest beta build version number.
)
void test9() { }
@Deprecated(
'Version number test (should fail). '
'This feature was deprecated after v1.21.0.' // ERROR: Deprecation notice does not accurately indicate a beta branch version number; please see https://flutter.dev/docs/development/tools/sdk/releases to find the latest beta build version number.
)
void test10() { }
@Deprecated(
'Version number test (special beta should pass). '
'This feature was deprecated after v3.1.0.'
)
void test11() { }
@Deprecated(
'Version number test (should be fine). '
'This feature was deprecated after v0.1.0.'
)
void test12() { }
@Deprecated(
'Version number test (should be fine). '
'This feature was deprecated after v1.20.0-1.0.pre.'
)
void test13() { }
@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() { }
@Deprecated( // flutter_ignore: deprecation_syntax, https://github.com/flutter/flutter/issues/000000
'Missing the version line. '
)
void test15() { }
// dart format on
// flutter_ignore: deprecation_syntax, https://github.com/flutter/flutter/issues/000000
@Deprecated('Missing the version line. ')
void test16() {}
class TestClass1 {
// flutter_ignore: deprecation_syntax, https://github.com/flutter/flutter/issues/000000
@Deprecated('Missing the version line. ')
void test() {}
}