diff --git a/test/all.dart b/test/all.dart index 7b7987ef8..991e07237 100644 --- a/test/all.dart +++ b/test/all.dart @@ -11,6 +11,7 @@ import 'engine_test.dart' as engine_test; import 'formatter_test.dart' as formatter_test; import 'integration_test.dart' as integration_test; import 'mocks.dart'; +import 'pubspec_test.dart' as pubspec_test; import 'rule_test.dart' as rule_test; import 'rules/all.dart' as reflective_rule_tests; import 'unmocked_sdk_rule_test.dart' as unmocked_sdk_rule_test; @@ -37,6 +38,7 @@ void main() { engine_test.main(); formatter_test.main(); integration_test.main(); + pubspec_test.main(); rule_test.main(); reflective_rule_tests.main(); unmocked_sdk_rule_test.main(); diff --git a/test/integration_test.dart b/test/integration_test.dart index d12b30e97..4b74debde 100644 --- a/test/integration_test.dart +++ b/test/integration_test.dart @@ -77,24 +77,6 @@ void coreTests() { }); }); - group('pubspec', () { - var currentOut = outSink; - var collectingOut = CollectingSink(); - setUp(() => outSink = collectingOut); - tearDown(() { - collectingOut.buffer.clear(); - outSink = currentOut; - }); - test('bad pubspec', () async { - await cli.run([ - '$integrationTestDir/p3', - '$integrationTestDir/p3/_pubpspec.yaml' - ]); - expect(collectingOut.trim(), - startsWith('1 file analyzed, 0 issues found, in')); - }); - }); - group('canonicalization', () { var currentOut = outSink; var collectingOut = CollectingSink(); diff --git a/test/pubspec_test.dart b/test/pubspec_test.dart new file mode 100644 index 000000000..b3e465ff1 --- /dev/null +++ b/test/pubspec_test.dart @@ -0,0 +1,29 @@ +// Copyright (c) 2023, 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:test_reflective_loader/test_reflective_loader.dart'; + +import 'rule_test_support.dart'; + +main() { + defineReflectiveSuite(() { + defineReflectiveTests(BadPubspecTest); + }); +} + +@reflectiveTest +class BadPubspecTest extends LintRuleTest { + @override + String get lintRule => 'sort_pub_dependencies'; + + // ignore: non_constant_identifier_names + test_malformedPubspec() async { + await assertNoPubspecDiagnostics(r''' +not: a + valid + pub + spec: +'''); + } +} diff --git a/test_data/integration/p3/_pubspec.yaml b/test_data/integration/p3/_pubspec.yaml deleted file mode 100644 index 9f2b56ba4..000000000 --- a/test_data/integration/p3/_pubspec.yaml +++ /dev/null @@ -1,4 +0,0 @@ -not: a - valid - pub - spec: \ No newline at end of file