d5da8dc67d
* Auto-dispose the TestProject (several instances were never disposed) * Don't rely on package:test by default from the test-project. Change-Id: I383eb36cbacb341b702f42075af562d20a2be45d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291069 Reviewed-by: Jonas Jensen <jonasfj@google.com> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
71 lines
2.1 KiB
Dart
71 lines
2.1 KiB
Dart
// Copyright (c) 2022, 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:dartdev/src/commands/info.dart';
|
|
import 'package:dartdev/src/core.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
import '../utils.dart';
|
|
|
|
void main() {
|
|
group('info', () {
|
|
late TestProject p;
|
|
|
|
test('--help', () async {
|
|
p = project();
|
|
final result = await p.run(['info', '--help']);
|
|
|
|
expect(result.stdout, isNotEmpty);
|
|
expect(result.stdout,
|
|
contains('Show diagnostic information about the installed tooling'));
|
|
expect(result.stderr, isEmpty);
|
|
expect(result.exitCode, 0);
|
|
});
|
|
|
|
test('shows general info', () async {
|
|
p = project(mainSrc: 'void main() {}');
|
|
final runResult = await p.run(['info']);
|
|
|
|
expect(runResult.stderr, isEmpty);
|
|
expect(runResult.exitCode, 0);
|
|
|
|
var output = runResult.stdout as String;
|
|
|
|
expect(output, contains('## General info'));
|
|
expect(output, contains('- Dart '));
|
|
});
|
|
|
|
test('shows project info', () async {
|
|
p = project(mainSrc: 'void main() {}');
|
|
final runResult = await p.run(['info']);
|
|
|
|
expect(runResult.stderr, isEmpty);
|
|
expect(runResult.exitCode, 0);
|
|
|
|
var output = runResult.stdout as String;
|
|
|
|
expect(output, contains('## Project info'));
|
|
expect(output, contains('- sdk constraint: '));
|
|
expect(output, contains('- dependencies: '));
|
|
});
|
|
|
|
test('getProjectInfo', () {
|
|
p = project(
|
|
mainSrc: 'void main() {}',
|
|
pubspecExtras: {
|
|
'dependencies': {'dummy_pkg': '0.0.1'},
|
|
},
|
|
);
|
|
var results = getProjectInfo(Project.fromDirectory(p.dir));
|
|
|
|
expect(results, isNotNull);
|
|
expect(results!.sdkDependency, isNotEmpty);
|
|
expect(results.dependencies, isNotEmpty);
|
|
expect(results.dependencies, unorderedEquals(['dummy_pkg']));
|
|
expect(results.devDependencies, isEmpty);
|
|
expect(results.elidedDependencies, 0);
|
|
});
|
|
}, timeout: longTimeout);
|
|
}
|