43e01310a4
Change-Id: I0a951ecbf8aa74d1c00df99e0f5bdab84bb00dde Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430542 Reviewed-by: Keerti Parthasarathy <keertip@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
71 lines
1.5 KiB
Dart
71 lines
1.5 KiB
Dart
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'package:analyzer/error/error.dart';
|
|
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
|
|
|
import '../rule_test_support.dart';
|
|
|
|
void main() {
|
|
defineReflectiveSuite(() {
|
|
defineReflectiveTests(CombinatorsOrderingTest);
|
|
});
|
|
}
|
|
|
|
@reflectiveTest
|
|
class CombinatorsOrderingTest extends LintRuleTest {
|
|
@override
|
|
List<DiagnosticCode> get ignoredDiagnosticCodes => [
|
|
WarningCode.UNUSED_IMPORT,
|
|
];
|
|
|
|
@override
|
|
String get lintRule => LintNames.combinators_ordering;
|
|
|
|
test_hideCombinator_import_sorted() async {
|
|
await assertNoDiagnostics(r'''
|
|
import 'dart:math' hide max, min;
|
|
''');
|
|
}
|
|
|
|
test_hideCombinator_import_unsorted() async {
|
|
await assertDiagnostics(
|
|
r'''
|
|
import 'dart:math' hide min, max;
|
|
''',
|
|
[lint(19, 13)],
|
|
);
|
|
}
|
|
|
|
test_showCombinator_export_sorted() async {
|
|
await assertNoDiagnostics(r'''
|
|
export 'dart:math' show max, min;
|
|
''');
|
|
}
|
|
|
|
test_showCombinator_export_unsorted() async {
|
|
await assertDiagnostics(
|
|
r'''
|
|
export 'dart:math' show min, max;
|
|
''',
|
|
[lint(19, 13)],
|
|
);
|
|
}
|
|
|
|
test_showCombinator_import_sorted() async {
|
|
await assertNoDiagnostics(r'''
|
|
import 'dart:math' show max, min;
|
|
''');
|
|
}
|
|
|
|
test_showCombinator_import_unsorted() async {
|
|
await assertDiagnostics(
|
|
r'''
|
|
import 'dart:math' show min, max;
|
|
''',
|
|
[lint(19, 13)],
|
|
);
|
|
}
|
|
}
|