prefer_const_literals_to_create_immutables extension type test

Closes: https://github.com/dart-lang/linter/issues/4722

Change-Id: Ifd60ab27242e802638c072e5957c5c35fe89c399
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323682
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
This commit is contained in:
pq 2023-08-31 19:33:37 +00:00 committed by Commit Queue
parent 565919a80f
commit 039640fad1

View file

@ -20,6 +20,19 @@ class PreferConstLiteralsToCreateImmutablesTest extends LintRuleTest {
@override
String get lintRule => 'prefer_const_literals_to_create_immutables';
test_extensionType() async {
await assertDiagnostics(r'''
import 'package:meta/meta.dart';
@immutable
extension type E(List<int> i) { }
var e = E([1]);
''', [
lint(90, 3),
]);
}
test_missingRequiredArgument() async {
await assertDiagnostics(r'''
import 'package:meta/meta.dart';