65c4d768f1
Changes are reformatting and using the nullable list element operator. Change-Id: Iea1f4d2fcb06056f14804c8fe8b33c0b4d9037f2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/477561 Commit-Queue: Sigurd Meldgaard <sigurdm@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com>
49 lines
1.7 KiB
Dart
49 lines
1.7 KiB
Dart
// Copyright (c) 2020, 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/test.dart';
|
|
|
|
import 'utils.dart';
|
|
|
|
void main() {
|
|
late TestProject p;
|
|
|
|
setUp(() async => p = project());
|
|
|
|
test('Ensure parsing fails after encountering invalid file', () async {
|
|
// Regression test for https://github.com/dart-lang/sdk/issues/43991
|
|
final noArgsResult = await p.run(['foo.dart']);
|
|
expect(noArgsResult.stderr, isNotEmpty);
|
|
expect(noArgsResult.stdout, isEmpty);
|
|
expect(noArgsResult.exitCode, 254);
|
|
|
|
final argsResult = await p.run(['foo.dart', '--bar']);
|
|
expect(argsResult.stderr, noArgsResult.stderr);
|
|
expect(argsResult.stdout, isEmpty);
|
|
expect(argsResult.exitCode, 254);
|
|
});
|
|
|
|
test(
|
|
'Providing --snapshot VM option with invalid script fails gracefully',
|
|
() async {
|
|
// Regression test for https://github.com/dart-lang/sdk/issues/43785
|
|
final result = await p.run(['--snapshot=abc', 'foo.dart']);
|
|
expect(result.stderr, isNotEmpty);
|
|
expect(result.stderr, contains("Error when reading 'foo.dart':"));
|
|
expect(result.stdout, isEmpty);
|
|
expect(result.exitCode, 254);
|
|
},
|
|
);
|
|
|
|
test('Will not try to run file named the same as command', () async {
|
|
p.file('pub', 'main() => print("All your base are belong to us")');
|
|
// Regression test for https://github.com/dart-lang/sdk/issues/43785
|
|
final result = await p.run(['pub']);
|
|
expect(result.stderr, isNotEmpty);
|
|
expect(result.stderr, contains('Missing subcommand'));
|
|
expect(result.stdout, isEmpty);
|
|
expect(result.exitCode, 64);
|
|
});
|
|
}
|