Shim package:test to avoid matcher issues (#20602)
* Upgrade everything except matcher. * Roll matcher (and test) * Adjust tests that depend on flutter:test directly to depend on a shim * Require use of package:test shim and remove other references to package:test
This commit is contained in:
committed by
Todd Volkert
parent
8de0e15e4f
commit
686d8f8a22
14
packages/fuchsia_remote_debug_protocol/test/common.dart
Normal file
14
packages/fuchsia_remote_debug_protocol/test/common.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Defines a 'package:test' shim.
|
||||
// TODO(ianh): Remove this file once https://github.com/dart-lang/matcher/issues/98 is fixed
|
||||
|
||||
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
|
||||
import 'package:test/test.dart' as test_package show TypeMatcher;
|
||||
|
||||
export 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
|
||||
|
||||
/// A matcher that compares the type of the actual value to the type argument T.
|
||||
Matcher isInstanceOf<T>() => new test_package.TypeMatcher<T>(); // ignore: prefer_const_constructors, https://github.com/dart-lang/sdk/issues/32544
|
||||
@@ -4,12 +4,13 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:test/test.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
|
||||
|
||||
import 'package:fuchsia_remote_debug_protocol/fuchsia_remote_debug_protocol.dart';
|
||||
|
||||
import 'common.dart';
|
||||
|
||||
void main() {
|
||||
group('FuchsiaRemoteConnection.connect', () {
|
||||
MockSshCommandRunner mockRunner;
|
||||
@@ -152,7 +153,7 @@ void main() {
|
||||
|
||||
// Should fail as no env variable has been passed.
|
||||
expect(failingFunction,
|
||||
throwsA(const isInstanceOf<FuchsiaRemoteConnectionError>()));
|
||||
throwsA(isInstanceOf<FuchsiaRemoteConnectionError>()));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ import 'dart:async';
|
||||
import 'package:fuchsia_remote_debug_protocol/src/dart/dart_vm.dart';
|
||||
import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../../common.dart';
|
||||
|
||||
void main() {
|
||||
group('DartVm.connect', () {
|
||||
@@ -203,7 +204,7 @@ void main() {
|
||||
}
|
||||
|
||||
// Both views should be invalid as they were missing required fields.
|
||||
expect(failingFunction, throwsA(const isInstanceOf<RpcFormatError>()));
|
||||
expect(failingFunction, throwsA(isInstanceOf<RpcFormatError>()));
|
||||
});
|
||||
|
||||
test('get isolates by pattern', () async {
|
||||
@@ -283,7 +284,7 @@ void main() {
|
||||
}
|
||||
|
||||
// Both views should be invalid as they were missing required fields.
|
||||
expect(failingFunction, throwsA(const isInstanceOf<RpcFormatError>()));
|
||||
expect(failingFunction, throwsA(isInstanceOf<RpcFormatError>()));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -315,7 +316,7 @@ void main() {
|
||||
await vm.invokeRpc('somesillyfunction', timeout: timeoutTime);
|
||||
}
|
||||
|
||||
expect(failingFunction, throwsA(const isInstanceOf<TimeoutException>()));
|
||||
expect(failingFunction, throwsA(isInstanceOf<TimeoutException>()));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io' show ProcessResult;
|
||||
|
||||
import 'package:test/test.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:process/process.dart';
|
||||
import 'package:fuchsia_remote_debug_protocol/src/runners/ssh_command_runner.dart';
|
||||
|
||||
import '../../common.dart';
|
||||
|
||||
void main() {
|
||||
group('SshCommandRunner.constructors', () {
|
||||
test('throws exception with invalid address', () async {
|
||||
@@ -99,7 +100,7 @@ void main() {
|
||||
await runner.run('oihaw');
|
||||
}
|
||||
|
||||
expect(failingFunction, throwsA(const isInstanceOf<SshCommandError>()));
|
||||
expect(failingFunction, throwsA(isInstanceOf<SshCommandError>()));
|
||||
});
|
||||
|
||||
test('verify correct args with config', () async {
|
||||
|
||||
Reference in New Issue
Block a user