Skip to content

Commit

Permalink
migrate malformed pubspec integration test (dart-lang/linter#4609)
Browse files Browse the repository at this point in the history
  • Loading branch information
pq authored Jul 24, 2023
1 parent bc66a04 commit 0291e43
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 22 deletions.
2 changes: 2 additions & 0 deletions test/all.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down
18 changes: 0 additions & 18 deletions test/integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,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();
Expand Down
29 changes: 29 additions & 0 deletions test/pubspec_test.dart
Original file line number Diff line number Diff line change
@@ -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:
''');
}
}
4 changes: 0 additions & 4 deletions test_data/integration/p3/_pubspec.yaml

This file was deleted.

0 comments on commit 0291e43

Please sign in to comment.