flutter/packages/flutter_tools/test/general.shard/base/common_test.dart
Jonah Williams 74bd7b6f6d
[flutter_tools] opt all flutter tool libraries and tests out of null safety. (#74832)
* opt out the flutter tool

* oops EOF

* fix import

* Update tool_backend.dart

* Update daemon_client.dart

* fix more
2021-01-27 15:17:53 -08:00

35 lines
1.1 KiB
Dart

// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'package:flutter_tools/src/base/common.dart';
import 'package:flutter_tools/src/base/context.dart';
import '../../src/common.dart';
void main() {
group('throwToolExit', () {
test('throws ToolExit', () {
expect(() => throwToolExit('message'), throwsToolExit());
});
test('throws ToolExit with exitCode', () {
expect(() => throwToolExit('message', exitCode: 42), throwsToolExit(exitCode: 42));
});
test('throws ToolExit with message', () {
expect(() => throwToolExit('message'), throwsToolExit(message: 'message'));
});
test('throws ToolExit with message and exit code', () {
expect(() => throwToolExit('message', exitCode: 42), throwsToolExit(exitCode: 42, message: 'message'));
});
testWithoutContext('Throws if accessing the Zone', () {
expect(() => context.get<Object>(), throwsA(isA<UnsupportedError>()));
});
});
}