fix analysis errors (#3677)
* fix analysis errors * review comments; fix test * re-add an export for debugPrint
This commit is contained in:
@@ -35,7 +35,9 @@ void main() {
|
||||
|
||||
AnalyzeCommand command = new AnalyzeCommand();
|
||||
applyMocksToCommand(command);
|
||||
return createTestCommandRunner(command).run(['analyze', '--no-current-package', '--no-current-directory', dartFileA.path, dartFileB.path]).then((int code) {
|
||||
return createTestCommandRunner(command).run(
|
||||
<String>['analyze', '--no-current-package', '--no-current-directory', dartFileA.path, dartFileB.path]
|
||||
).then((int code) {
|
||||
expect(code, equals(1));
|
||||
expect(testLogger.errorText, '[warning] The imported libraries \'a.dart\' and \'b.dart\' cannot have the same name \'test\' (${dartFileB.path})\n');
|
||||
expect(testLogger.statusText, 'Analyzing 2 entry points...\n');
|
||||
|
||||
@@ -88,7 +88,7 @@ void main() {
|
||||
(Map<String, dynamic> result) => responses.add(result),
|
||||
notifyingLogger: notifyingLogger
|
||||
);
|
||||
commands.add({'id': 0, 'method': 'daemon.shutdown'});
|
||||
commands.add(<String, dynamic>{'id': 0, 'method': 'daemon.shutdown'});
|
||||
return daemon.onExit.then((int code) {
|
||||
expect(code, 0);
|
||||
});
|
||||
@@ -121,7 +121,7 @@ void main() {
|
||||
(Map<String, dynamic> result) => responses.add(result),
|
||||
notifyingLogger: notifyingLogger
|
||||
);
|
||||
commands.add({'id': 0, 'method': 'device.getDevices'});
|
||||
commands.add(<String, dynamic>{'id': 0, 'method': 'device.getDevices'});
|
||||
Map<String, dynamic> response = await responses.stream.where(_notEvent).first;
|
||||
expect(response['id'], 0);
|
||||
expect(response['result'], isList);
|
||||
|
||||
@@ -14,14 +14,14 @@ void main() {
|
||||
group('devices', () {
|
||||
testUsingContext('returns 0 when called', () {
|
||||
DevicesCommand command = new DevicesCommand();
|
||||
return createTestCommandRunner(command).run(['list']).then((int code) {
|
||||
return createTestCommandRunner(command).run(<String>['list']).then((int code) {
|
||||
expect(code, equals(0));
|
||||
});
|
||||
});
|
||||
|
||||
testUsingContext('no error when no connected devices', () {
|
||||
DevicesCommand command = new DevicesCommand();
|
||||
return createTestCommandRunner(command).run(['list']).then((int code) {
|
||||
return createTestCommandRunner(command).run(<String>['list']).then((int code) {
|
||||
expect(code, equals(0));
|
||||
expect(testLogger.statusText, contains('No connected devices'));
|
||||
});
|
||||
|
||||
@@ -60,7 +60,7 @@ void main() {
|
||||
|
||||
testUsingContext('returns 1 when test file is not found', () {
|
||||
withMockDevice();
|
||||
List<String> args = [
|
||||
List<String> args = <String>[
|
||||
'drive',
|
||||
'--target=/some/app/test/e2e.dart',
|
||||
];
|
||||
@@ -84,7 +84,7 @@ void main() {
|
||||
await memFs.file(testApp).writeAsString('main() {}');
|
||||
await memFs.file(testFile).writeAsString('main() {}');
|
||||
|
||||
List<String> args = [
|
||||
List<String> args = <String>[
|
||||
'drive',
|
||||
'--target=$testApp',
|
||||
];
|
||||
@@ -102,7 +102,7 @@ void main() {
|
||||
useInMemoryFileSystem(cwd: packageDir);
|
||||
|
||||
String appFile = '/not/in/my/app.dart';
|
||||
List<String> args = [
|
||||
List<String> args = <String>[
|
||||
'drive',
|
||||
'--target=$appFile',
|
||||
];
|
||||
@@ -120,7 +120,7 @@ void main() {
|
||||
useInMemoryFileSystem(cwd: packageDir);
|
||||
|
||||
String appFile = '/my/app/main.dart';
|
||||
List<String> args = [
|
||||
List<String> args = <String>[
|
||||
'drive',
|
||||
'--target=$appFile',
|
||||
];
|
||||
@@ -144,7 +144,7 @@ void main() {
|
||||
return new Future<int>.value(0);
|
||||
});
|
||||
testRunner = expectAsync((List<String> testArgs) {
|
||||
expect(testArgs, [testFile]);
|
||||
expect(testArgs, <String>[testFile]);
|
||||
return new Future<int>.value(0);
|
||||
});
|
||||
appStopper = expectAsync((_) {
|
||||
@@ -155,7 +155,7 @@ void main() {
|
||||
await memFs.file(testApp).writeAsString('main() {}');
|
||||
await memFs.file(testFile).writeAsString('main() {}');
|
||||
|
||||
List<String> args = [
|
||||
List<String> args = <String>[
|
||||
'drive',
|
||||
'--target=$testApp',
|
||||
];
|
||||
@@ -186,7 +186,7 @@ void main() {
|
||||
await memFs.file(testApp).writeAsString('main() {}');
|
||||
await memFs.file(testFile).writeAsString('main() {}');
|
||||
|
||||
List<String> args = [
|
||||
List<String> args = <String>[
|
||||
'drive',
|
||||
'--target=$testApp',
|
||||
];
|
||||
@@ -243,7 +243,7 @@ void main() {
|
||||
Device emulator = new MockDevice();
|
||||
when(emulator.name).thenReturn('new-simulator');
|
||||
when(IOSSimulatorUtils.instance.getAttachedDevices())
|
||||
.thenReturn([emulator]);
|
||||
.thenReturn(<Device>[emulator]);
|
||||
|
||||
Device device = await findTargetDevice();
|
||||
expect(device.name, 'new-simulator');
|
||||
|
||||
@@ -21,7 +21,7 @@ void main() {
|
||||
when(device.installApp(any)).thenReturn(true);
|
||||
testDeviceManager.addDevice(device);
|
||||
|
||||
return createTestCommandRunner(command).run(['install']).then((int code) {
|
||||
return createTestCommandRunner(command).run(<String>['install']).then((int code) {
|
||||
expect(code, equals(0));
|
||||
});
|
||||
});
|
||||
@@ -35,7 +35,7 @@ void main() {
|
||||
when(device.installApp(any)).thenReturn(true);
|
||||
testDeviceManager.addDevice(device);
|
||||
|
||||
return createTestCommandRunner(command).run(['install']).then((int code) {
|
||||
return createTestCommandRunner(command).run(<String>['install']).then((int code) {
|
||||
expect(code, equals(0));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ void main() {
|
||||
testUsingContext('returns 1 when no device is connected', () {
|
||||
ListenCommand command = new ListenCommand(singleRun: true);
|
||||
applyMocksToCommand(command);
|
||||
return createTestCommandRunner(command).run(['listen']).then((int code) {
|
||||
return createTestCommandRunner(command).run(<String>['listen']).then((int code) {
|
||||
expect(code, equals(1));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -108,7 +108,7 @@ class MockDoctor extends Doctor {
|
||||
|
||||
class MockSimControl extends Mock implements SimControl {
|
||||
MockSimControl() {
|
||||
when(this.getConnectedDevices()).thenReturn([]);
|
||||
when(this.getConnectedDevices()).thenReturn(<SimDevice>[]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ void main() {
|
||||
MockAndroidDevice device = new MockAndroidDevice();
|
||||
when(device.stopApp(any)).thenReturn(new Future<bool>.value(true));
|
||||
testDeviceManager.addDevice(device);
|
||||
return createTestCommandRunner(command).run(['stop']).then((int code) {
|
||||
return createTestCommandRunner(command).run(<String>['stop']).then((int code) {
|
||||
expect(code, equals(0));
|
||||
});
|
||||
});
|
||||
@@ -32,7 +32,7 @@ void main() {
|
||||
when(device.stopApp(any)).thenReturn(new Future<bool>.value(true));
|
||||
testDeviceManager.addDevice(device);
|
||||
|
||||
return createTestCommandRunner(command).run(['stop']).then((int code) {
|
||||
return createTestCommandRunner(command).run(<String>['stop']).then((int code) {
|
||||
expect(code, equals(0));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ void main() {
|
||||
testUsingContext('returns 1 when no Android device is connected', () {
|
||||
TraceCommand command = new TraceCommand();
|
||||
applyMocksToCommand(command);
|
||||
return createTestCommandRunner(command).run(['trace']).then((int code) {
|
||||
return createTestCommandRunner(command).run(<String>['trace']).then((int code) {
|
||||
expect(code, equals(1));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user