use throwsXxx instead of throwsA(isA<Xxx>()) (#82328)
This commit is contained in:
parent
ab2aa31944
commit
7d46d43635
@ -39,7 +39,7 @@ Future<void> main() async {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
throwsA(isA<AssertionError>().having(
|
throwsA(isAssertionError.having(
|
||||||
(AssertionError error) => error.toString(),
|
(AssertionError error) => error.toString(),
|
||||||
'.toString()',
|
'.toString()',
|
||||||
contains('items.length'),
|
contains('items.length'),
|
||||||
|
@ -94,7 +94,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
throwsA(isA<AssertionError>().having(
|
throwsA(isAssertionError.having(
|
||||||
(AssertionError error) => error.toString(),
|
(AssertionError error) => error.toString(),
|
||||||
'.toString()',
|
'.toString()',
|
||||||
contains('children.length'),
|
contains('children.length'),
|
||||||
@ -110,7 +110,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
throwsA(isA<AssertionError>().having(
|
throwsA(isAssertionError.having(
|
||||||
(AssertionError error) => error.toString(),
|
(AssertionError error) => error.toString(),
|
||||||
'.toString()',
|
'.toString()',
|
||||||
contains('children.length'),
|
contains('children.length'),
|
||||||
@ -220,7 +220,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
throwsA(isA<AssertionError>().having(
|
throwsA(isAssertionError.having(
|
||||||
(AssertionError error) => error.toString(),
|
(AssertionError error) => error.toString(),
|
||||||
'.toString()',
|
'.toString()',
|
||||||
contains('children'),
|
contains('children'),
|
||||||
|
@ -82,7 +82,7 @@ void main() {
|
|||||||
onValueChanged: defaultCallback,
|
onValueChanged: defaultCallback,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
throwsA(isA<AssertionError>().having(
|
throwsA(isAssertionError.having(
|
||||||
(AssertionError error) => error.toString(),
|
(AssertionError error) => error.toString(),
|
||||||
'.toString()',
|
'.toString()',
|
||||||
contains('children.length'),
|
contains('children.length'),
|
||||||
@ -97,7 +97,7 @@ void main() {
|
|||||||
onValueChanged: defaultCallback,
|
onValueChanged: defaultCallback,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
throwsA(isA<AssertionError>().having(
|
throwsA(isAssertionError.having(
|
||||||
(AssertionError error) => error.toString(),
|
(AssertionError error) => error.toString(),
|
||||||
'.toString()',
|
'.toString()',
|
||||||
contains('children.length'),
|
contains('children.length'),
|
||||||
@ -117,7 +117,7 @@ void main() {
|
|||||||
onValueChanged: defaultCallback,
|
onValueChanged: defaultCallback,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
throwsA(isA<AssertionError>().having(
|
throwsA(isAssertionError.having(
|
||||||
(AssertionError error) => error.toString(),
|
(AssertionError error) => error.toString(),
|
||||||
'.toString()',
|
'.toString()',
|
||||||
contains('groupValue must be either null or one of the keys in the children map'),
|
contains('groupValue must be either null or one of the keys in the children map'),
|
||||||
|
@ -588,7 +588,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
throwsA(isA<AssertionError>().having(
|
throwsA(isAssertionError.having(
|
||||||
(AssertionError error) => error.toString(),
|
(AssertionError error) => error.toString(),
|
||||||
'.toString()',
|
'.toString()',
|
||||||
contains("There should be exactly one item with [DropdownButton]'s value"),
|
contains("There should be exactly one item with [DropdownButton]'s value"),
|
||||||
@ -617,7 +617,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
throwsA(isA<AssertionError>().having(
|
throwsA(isAssertionError.having(
|
||||||
(AssertionError error) => error.toString(),
|
(AssertionError error) => error.toString(),
|
||||||
'.toString()',
|
'.toString()',
|
||||||
contains("There should be exactly one item with [DropdownButton]'s value"),
|
contains("There should be exactly one item with [DropdownButton]'s value"),
|
||||||
|
@ -457,7 +457,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
throwsA(isA<AssertionError>().having(
|
throwsA(isAssertionError.having(
|
||||||
(AssertionError error) => error.toString(),
|
(AssertionError error) => error.toString(),
|
||||||
'.toString()',
|
'.toString()',
|
||||||
contains("There should be exactly one item with [DropdownButton]'s value"),
|
contains("There should be exactly one item with [DropdownButton]'s value"),
|
||||||
@ -486,7 +486,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
throwsA(isA<AssertionError>().having(
|
throwsA(isAssertionError.having(
|
||||||
(AssertionError error) => error.toString(),
|
(AssertionError error) => error.toString(),
|
||||||
'.toString()',
|
'.toString()',
|
||||||
contains("There should be exactly one item with [DropdownButton]'s value"),
|
contains("There should be exactly one item with [DropdownButton]'s value"),
|
||||||
|
@ -185,7 +185,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
throwsA(isA<AssertionError>().having(
|
throwsA(isAssertionError.having(
|
||||||
(AssertionError error) => error.toString(),
|
(AssertionError error) => error.toString(),
|
||||||
'.toString()',
|
'.toString()',
|
||||||
allOf(
|
allOf(
|
||||||
|
@ -980,7 +980,7 @@ void main() {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
throwsA(isA<AssertionError>().having(
|
throwsA(isAssertionError.having(
|
||||||
(AssertionError error) => error.message,
|
(AssertionError error) => error.message,
|
||||||
'message',
|
'message',
|
||||||
'paintTransform must be invertible.',
|
'paintTransform must be invertible.',
|
||||||
@ -996,7 +996,7 @@ void main() {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
throwsA(isA<AssertionError>().having(
|
throwsA(isAssertionError.having(
|
||||||
(AssertionError error) => error.message,
|
(AssertionError error) => error.message,
|
||||||
'message',
|
'message',
|
||||||
'Exactly one transform or offset argument must be provided.',
|
'Exactly one transform or offset argument must be provided.',
|
||||||
|
@ -183,7 +183,7 @@ void main() {
|
|||||||
// child1 is not given up before running finalizers.
|
// child1 is not given up before running finalizers.
|
||||||
expect(
|
expect(
|
||||||
() => manager.doSerialization(),
|
() => manager.doSerialization(),
|
||||||
throwsA(isA<FlutterError>().having(
|
throwsA(isFlutterError.having(
|
||||||
(FlutterError error) => error.message,
|
(FlutterError error) => error.message,
|
||||||
'message',
|
'message',
|
||||||
equals(
|
equals(
|
||||||
|
@ -768,7 +768,7 @@ void main() {
|
|||||||
child: GridView.extent(
|
child: GridView.extent(
|
||||||
maxCrossAxisExtent: maxCrossAxisExtent,
|
maxCrossAxisExtent: maxCrossAxisExtent,
|
||||||
),
|
),
|
||||||
), throwsA(isA<AssertionError>()));
|
), throwsAssertionError);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ void main() {
|
|||||||
itemExtent: 20.0,
|
itemExtent: 20.0,
|
||||||
children: const <Widget>[],
|
children: const <Widget>[],
|
||||||
),
|
),
|
||||||
throwsA(isA<AssertionError>().having(
|
throwsA(isAssertionError.having(
|
||||||
(AssertionError error) => error.message,
|
(AssertionError error) => error.message,
|
||||||
'message',
|
'message',
|
||||||
contains("You can't set a diameterRatio of 0"),
|
contains("You can't set a diameterRatio of 0"),
|
||||||
|
@ -758,7 +758,7 @@ void main() {
|
|||||||
final PageController controller = PageController();
|
final PageController controller = PageController();
|
||||||
expect(
|
expect(
|
||||||
() => controller.page,
|
() => controller.page,
|
||||||
throwsA(isA<AssertionError>().having(
|
throwsA(isAssertionError.having(
|
||||||
(AssertionError error) => error.message,
|
(AssertionError error) => error.message,
|
||||||
'message',
|
'message',
|
||||||
equals('PageController.page cannot be accessed before a PageView is built with it.'),
|
equals('PageController.page cannot be accessed before a PageView is built with it.'),
|
||||||
@ -792,7 +792,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
() => controller.page,
|
() => controller.page,
|
||||||
throwsA(isA<AssertionError>().having(
|
throwsA(isAssertionError.having(
|
||||||
(AssertionError error) => error.message,
|
(AssertionError error) => error.message,
|
||||||
'message',
|
'message',
|
||||||
equals('PageController.page cannot be accessed before a PageView is built with it.'),
|
equals('PageController.page cannot be accessed before a PageView is built with it.'),
|
||||||
|
@ -632,11 +632,11 @@ void main() {
|
|||||||
|
|
||||||
group('VMServiceFlutterDriver Unsupported error', () {
|
group('VMServiceFlutterDriver Unsupported error', () {
|
||||||
test('enableAccessibility', () async {
|
test('enableAccessibility', () async {
|
||||||
expect(driver.enableAccessibility(), throwsA(isA<UnsupportedError>()));
|
expect(driver.enableAccessibility(), throwsUnsupportedError);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('webDriver', () async {
|
test('webDriver', () async {
|
||||||
expect(() => driver.webDriver, throwsA(isA<UnsupportedError>()));
|
expect(() => driver.webDriver, throwsUnsupportedError);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -913,28 +913,23 @@ void main() {
|
|||||||
|
|
||||||
group('WebFlutterDriver Unimplemented/Unsupported error', () {
|
group('WebFlutterDriver Unimplemented/Unsupported error', () {
|
||||||
test('forceGC', () async {
|
test('forceGC', () async {
|
||||||
expect(driver.forceGC(),
|
expect(driver.forceGC(), throwsUnimplementedError);
|
||||||
throwsA(isA<UnimplementedError>()));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getVmFlags', () async {
|
test('getVmFlags', () async {
|
||||||
expect(driver.getVmFlags(),
|
expect(driver.getVmFlags(), throwsUnimplementedError);
|
||||||
throwsA(isA<UnimplementedError>()));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('waitUntilFirstFrameRasterized', () async {
|
test('waitUntilFirstFrameRasterized', () async {
|
||||||
expect(driver.waitUntilFirstFrameRasterized(),
|
expect(driver.waitUntilFirstFrameRasterized(), throwsUnimplementedError);
|
||||||
throwsA(isA<UnimplementedError>()));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('appIsoloate', () async {
|
test('appIsoloate', () async {
|
||||||
expect(() => driver.appIsolate.extensionRPCs,
|
expect(() => driver.appIsolate.extensionRPCs, throwsUnsupportedError);
|
||||||
throwsA(isA<UnsupportedError>()));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('serviceClient', () async {
|
test('serviceClient', () async {
|
||||||
expect(() => driver.serviceClient.getVM(),
|
expect(() => driver.serviceClient.getVM(), throwsUnsupportedError);
|
||||||
throwsA(isA<UnsupportedError>()));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -949,14 +944,10 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('tracing', () async {
|
test('tracing', () async {
|
||||||
expect(driver.traceAction(() async { return Future<dynamic>.value(); }),
|
expect(driver.traceAction(() async { return Future<dynamic>.value(); }), throwsUnsupportedError);
|
||||||
throwsA(isA<UnsupportedError>()));
|
expect(driver.startTracing(), throwsUnsupportedError);
|
||||||
expect(driver.startTracing(),
|
expect(driver.stopTracingAndDownloadTimeline(), throwsUnsupportedError);
|
||||||
throwsA(isA<UnsupportedError>()));
|
expect(driver.clearTimeline(), throwsUnsupportedError);
|
||||||
expect(driver.stopTracingAndDownloadTimeline(),
|
|
||||||
throwsA(isA<UnsupportedError>()));
|
|
||||||
expect(driver.clearTimeline(),
|
|
||||||
throwsA(isA<UnsupportedError>()));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('io_extension should throw exception', () {
|
test('io_extension should throw exception', () {
|
||||||
expect(() => registerWebServiceExtension(call),
|
expect(() => registerWebServiceExtension(call), throwsUnsupportedError);
|
||||||
throwsA(isA<UnsupportedError>()));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ void main() {
|
|||||||
await fs.file(fix('/golden.png')).writeAsBytes(_kColorFailurePngBytes);
|
await fs.file(fix('/golden.png')).writeAsBytes(_kColorFailurePngBytes);
|
||||||
await expectLater(
|
await expectLater(
|
||||||
() => doComparison(),
|
() => doComparison(),
|
||||||
throwsA(isA<FlutterError>().having(
|
throwsA(isFlutterError.having(
|
||||||
(FlutterError error) => error.message,
|
(FlutterError error) => error.message,
|
||||||
'message',
|
'message',
|
||||||
contains('% diff detected'),
|
contains('% diff detected'),
|
||||||
@ -216,7 +216,7 @@ void main() {
|
|||||||
..writeAsBytesSync(_kColorFailurePngBytes);
|
..writeAsBytesSync(_kColorFailurePngBytes);
|
||||||
await expectLater(
|
await expectLater(
|
||||||
() => doComparison('subdir/golden.png'),
|
() => doComparison('subdir/golden.png'),
|
||||||
throwsA(isA<FlutterError>().having(
|
throwsA(isFlutterError.having(
|
||||||
(FlutterError error) => error.message,
|
(FlutterError error) => error.message,
|
||||||
'message',
|
'message',
|
||||||
contains('% diff detected'),
|
contains('% diff detected'),
|
||||||
@ -255,7 +255,7 @@ void main() {
|
|||||||
await fs.file(fix('/golden.png')).writeAsBytes(_kSizeFailurePngBytes);
|
await fs.file(fix('/golden.png')).writeAsBytes(_kSizeFailurePngBytes);
|
||||||
await expectLater(
|
await expectLater(
|
||||||
() => doComparison(),
|
() => doComparison(),
|
||||||
throwsA(isA<FlutterError>().having(
|
throwsA(isFlutterError.having(
|
||||||
(FlutterError error) => error.message,
|
(FlutterError error) => error.message,
|
||||||
'message',
|
'message',
|
||||||
contains('image sizes do not match'),
|
contains('image sizes do not match'),
|
||||||
@ -267,7 +267,7 @@ void main() {
|
|||||||
await fs.file(fix('/golden.png')).writeAsBytes(_kColorFailurePngBytes);
|
await fs.file(fix('/golden.png')).writeAsBytes(_kColorFailurePngBytes);
|
||||||
await expectLater(
|
await expectLater(
|
||||||
() => doComparison(),
|
() => doComparison(),
|
||||||
throwsA(isA<FlutterError>().having(
|
throwsA(isFlutterError.having(
|
||||||
(FlutterError error) => error.message,
|
(FlutterError error) => error.message,
|
||||||
'message',
|
'message',
|
||||||
contains('% diff detected'),
|
contains('% diff detected'),
|
||||||
@ -279,7 +279,7 @@ void main() {
|
|||||||
await fs.file(fix('/golden.png')).writeAsBytes(<int>[]);
|
await fs.file(fix('/golden.png')).writeAsBytes(<int>[]);
|
||||||
await expectLater(
|
await expectLater(
|
||||||
() => doComparison(),
|
() => doComparison(),
|
||||||
throwsA(isA<FlutterError>().having(
|
throwsA(isFlutterError.having(
|
||||||
(FlutterError error) => error.message,
|
(FlutterError error) => error.message,
|
||||||
'message',
|
'message',
|
||||||
contains('null image provided'),
|
contains('null image provided'),
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
// @dart = 2.8
|
// @dart = 2.8
|
||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:flutter_tools/src/base/common.dart';
|
|
||||||
import 'package:flutter_tools/src/runner/flutter_command.dart';
|
import 'package:flutter_tools/src/runner/flutter_command.dart';
|
||||||
|
|
||||||
|
import '../../src/common.dart';
|
||||||
import '../../src/context.dart';
|
import '../../src/context.dart';
|
||||||
import '../../src/test_flutter_command_runner.dart';
|
import '../../src/test_flutter_command_runner.dart';
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ void main() {
|
|||||||
expect(() => commandRunner.run(<String>[
|
expect(() => commandRunner.run(<String>[
|
||||||
'build',
|
'build',
|
||||||
'--obfuscate',
|
'--obfuscate',
|
||||||
]), throwsA(isA<ToolExit>()));
|
]), throwsToolExit());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
// @dart = 2.8
|
// @dart = 2.8
|
||||||
|
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/base/common.dart';
|
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/commands/generate_localizations.dart';
|
import 'package:flutter_tools/src/commands/generate_localizations.dart';
|
||||||
import 'package:flutter_tools/src/runner/flutter_command.dart';
|
import 'package:flutter_tools/src/runner/flutter_command.dart';
|
||||||
|
|
||||||
import '../../integration.shard/test_data/basic_project.dart';
|
import '../../integration.shard/test_data/basic_project.dart';
|
||||||
|
import '../../src/common.dart';
|
||||||
import '../../src/context.dart';
|
import '../../src/context.dart';
|
||||||
import '../../src/test_flutter_command_runner.dart';
|
import '../../src/test_flutter_command_runner.dart';
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ void main() {
|
|||||||
'--header="some header',
|
'--header="some header',
|
||||||
'--header-file="header.txt"',
|
'--header-file="header.txt"',
|
||||||
]),
|
]),
|
||||||
throwsA(isA<ToolExit>()),
|
throwsToolExit(),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ void main() {
|
|||||||
'--no-pub',
|
'--no-pub',
|
||||||
'--show-test-device',
|
'--show-test-device',
|
||||||
]),
|
]),
|
||||||
throwsA(isA<Exception>().having(
|
throwsA(isException.having(
|
||||||
(Exception exception) => exception.toString(),
|
(Exception exception) => exception.toString(),
|
||||||
'toString',
|
'toString',
|
||||||
isNot(contains('--fast-start is not supported with --use-application-binary')),
|
isNot(contains('--fast-start is not supported with --use-application-binary')),
|
||||||
@ -102,7 +102,7 @@ void main() {
|
|||||||
'run',
|
'run',
|
||||||
'--no-pub',
|
'--no-pub',
|
||||||
]),
|
]),
|
||||||
throwsA(isA<ToolExit>()),
|
throwsToolExit(),
|
||||||
);
|
);
|
||||||
final BufferLogger bufferLogger = globals.logger as BufferLogger;
|
final BufferLogger bufferLogger = globals.logger as BufferLogger;
|
||||||
expect(
|
expect(
|
||||||
@ -127,11 +127,7 @@ void main() {
|
|||||||
'run',
|
'run',
|
||||||
'--no-pub',
|
'--no-pub',
|
||||||
]),
|
]),
|
||||||
throwsA(isA<ToolExit>().having(
|
throwsToolExit(message: 'No pubspec.yaml file found'),
|
||||||
(ToolExit error) => error.toString(),
|
|
||||||
'toString()',
|
|
||||||
contains('No pubspec.yaml file found'),
|
|
||||||
)),
|
|
||||||
);
|
);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fileSystem,
|
FileSystem: () => fileSystem,
|
||||||
@ -510,7 +506,7 @@ void main() {
|
|||||||
'run',
|
'run',
|
||||||
'--no-pub',
|
'--no-pub',
|
||||||
'--bundle-sksl-path=foo.json',
|
'--bundle-sksl-path=foo.json',
|
||||||
]), throwsA(isA<ToolExit>().having((ToolExit exit) => exit.message, 'message', contains('No SkSL shader bundle found at foo.json'))));
|
]), throwsToolExit(message: 'No SkSL shader bundle found at foo.json'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,12 +30,12 @@ void main() {
|
|||||||
|
|
||||||
await expectLater(() => createTestCommandRunner(ScreenshotCommand())
|
await expectLater(() => createTestCommandRunner(ScreenshotCommand())
|
||||||
.run(<String>['screenshot', '--type=skia', '--observatory-url=http://localhost:8181']),
|
.run(<String>['screenshot', '--type=skia', '--observatory-url=http://localhost:8181']),
|
||||||
throwsA(isA<Exception>().having((dynamic exception) => exception.toString(), 'message', contains('dummy'))),
|
throwsA(isException.having((Exception exception) => exception.toString(), 'message', contains('dummy'))),
|
||||||
);
|
);
|
||||||
|
|
||||||
await expectLater(() => createTestCommandRunner(ScreenshotCommand())
|
await expectLater(() => createTestCommandRunner(ScreenshotCommand())
|
||||||
.run(<String>['screenshot', '--type=rasterizer', '--observatory-url=http://localhost:8181']),
|
.run(<String>['screenshot', '--type=rasterizer', '--observatory-url=http://localhost:8181']),
|
||||||
throwsA(isA<Exception>().having((dynamic exception) => exception.toString(), 'message', contains('dummy'))),
|
throwsA(isException.having((Exception exception) => exception.toString(), 'message', contains('dummy'))),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -211,8 +211,7 @@ dev_dependencies:
|
|||||||
'--coverage',
|
'--coverage',
|
||||||
'--',
|
'--',
|
||||||
'test/fake_test.dart',
|
'test/fake_test.dart',
|
||||||
]), throwsA(isA<ToolExit>()
|
]), throwsA(isA<ToolExit>().having((ToolExit toolExit) => toolExit.message, 'message', isNull)));
|
||||||
.having((ToolExit toolExit) => toolExit.message, 'message', isNull)));
|
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
// @dart = 2.8
|
// @dart = 2.8
|
||||||
|
|
||||||
import 'package:flutter_tools/src/android/android_device.dart';
|
import 'package:flutter_tools/src/android/android_device.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/device_port_forwarder.dart';
|
import 'package:flutter_tools/src/device_port_forwarder.dart';
|
||||||
|
|
||||||
@ -78,7 +77,7 @@ void main() {
|
|||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(forwarder.forward(123, hostPort: 456), throwsA(isA<ProcessException>()));
|
expect(forwarder.forward(123, hostPort: 456), throwsProcessException());
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('AndroidDevicePortForwarder forwardedPorts returns empty '
|
testWithoutContext('AndroidDevicePortForwarder forwardedPorts returns empty '
|
||||||
@ -159,6 +158,6 @@ void main() {
|
|||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(() => forwarder.unforward(ForwardedPort(456, 23)), throwsA(isA<ProcessException>()));
|
expect(() => forwarder.unforward(ForwardedPort(456, 23)), throwsProcessException());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -358,7 +358,7 @@ void main() {
|
|||||||
..writeAsStringSync('apply from: irrelevant/flutter.gradle');
|
..writeAsStringSync('apply from: irrelevant/flutter.gradle');
|
||||||
|
|
||||||
await expectLater(() async {
|
await expectLater(() async {
|
||||||
await builder.buildGradleApp(
|
await builder.buildGradleApp(
|
||||||
project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
project: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
||||||
androidBuildInfo: const AndroidBuildInfo(
|
androidBuildInfo: const AndroidBuildInfo(
|
||||||
BuildInfo(
|
BuildInfo(
|
||||||
@ -371,8 +371,7 @@ void main() {
|
|||||||
isBuildingBundle: false,
|
isBuildingBundle: false,
|
||||||
localGradleErrors: const <GradleHandledError>[],
|
localGradleErrors: const <GradleHandledError>[],
|
||||||
);
|
);
|
||||||
},
|
}, throwsProcessException());
|
||||||
throwsA(isA<ProcessException>()));
|
|
||||||
expect(processManager, hasNoRemainingExpectations);
|
expect(processManager, hasNoRemainingExpectations);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:file_testing/file_testing.dart';
|
import 'package:file_testing/file_testing.dart';
|
||||||
import 'package:flutter_tools/src/base/common.dart';
|
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
@ -288,7 +287,7 @@ void main() {
|
|||||||
'test message',
|
'test message',
|
||||||
Uri.parse('http://test.zip'),
|
Uri.parse('http://test.zip'),
|
||||||
fileSystem.currentDirectory.childDirectory('out'),
|
fileSystem.currentDirectory.childDirectory('out'),
|
||||||
), throwsA(isA<ArgumentError>()));
|
), throwsArgumentError);
|
||||||
|
|
||||||
expect(logger.statusText, contains('test message'));
|
expect(logger.statusText, contains('test message'));
|
||||||
expect(fileSystem.file('out/test'), isNot(exists));
|
expect(fileSystem.file('out/test'), isNot(exists));
|
||||||
@ -361,7 +360,7 @@ void main() {
|
|||||||
'test message',
|
'test message',
|
||||||
Uri.parse('http://test.zip'),
|
Uri.parse('http://test.zip'),
|
||||||
fileSystem.currentDirectory.childDirectory('out'),
|
fileSystem.currentDirectory.childDirectory('out'),
|
||||||
), throwsA(isA<ToolExit>()));
|
), throwsToolExit());
|
||||||
expect(fileSystem.file('te,[/test'), isNot(exists));
|
expect(fileSystem.file('te,[/test'), isNot(exists));
|
||||||
expect(fileSystem.file('out/test'), isNot(exists));
|
expect(fileSystem.file('out/test'), isNot(exists));
|
||||||
});
|
});
|
||||||
@ -385,7 +384,7 @@ void main() {
|
|||||||
'test message',
|
'test message',
|
||||||
Uri.parse('http://test.zip'),
|
Uri.parse('http://test.zip'),
|
||||||
fileSystem.currentDirectory.childDirectory('out'),
|
fileSystem.currentDirectory.childDirectory('out'),
|
||||||
), throwsA(isA<ToolExit>()));
|
), throwsToolExit());
|
||||||
expect(fileSystem.file('te,[/test'), isNot(exists));
|
expect(fileSystem.file('te,[/test'), isNot(exists));
|
||||||
expect(fileSystem.file('out/test'), isNot(exists));
|
expect(fileSystem.file('out/test'), isNot(exists));
|
||||||
});
|
});
|
||||||
|
@ -26,7 +26,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('Throws if accessing the Zone', () {
|
testWithoutContext('Throws if accessing the Zone', () {
|
||||||
expect(() => context.get<Object>(), throwsA(isA<UnsupportedError>()));
|
expect(() => context.get<Object>(), throwsUnsupportedError);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ void main() {
|
|||||||
when(file.deleteSync(recursive: false))
|
when(file.deleteSync(recursive: false))
|
||||||
.thenThrow(const FileSystemException('', '', OSError('', 2)));
|
.thenThrow(const FileSystemException('', '', OSError('', 2)));
|
||||||
|
|
||||||
expect(() => ErrorHandlingFileSystem.deleteIfExists(file), throwsA(isA<ToolExit>()));
|
expect(() => ErrorHandlingFileSystem.deleteIfExists(file), throwsToolExit());
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('deleteIfExists does not tool exit if file exists on read-only '
|
testWithoutContext('deleteIfExists does not tool exit if file exists on read-only '
|
||||||
@ -182,7 +182,7 @@ void main() {
|
|||||||
ErrorHandlingFileSystem.noExitOnFailure(() {
|
ErrorHandlingFileSystem.noExitOnFailure(() {
|
||||||
ErrorHandlingFileSystem.deleteIfExists(file);
|
ErrorHandlingFileSystem.deleteIfExists(file);
|
||||||
});
|
});
|
||||||
}, throwsA(isA<FileSystemException>()));
|
}, throwsFileSystemException());
|
||||||
});
|
});
|
||||||
|
|
||||||
group('throws ToolExit on Windows', () {
|
group('throws ToolExit on Windows', () {
|
||||||
@ -213,7 +213,7 @@ void main() {
|
|||||||
final File file = fs.file('file');
|
final File file = fs.file('file');
|
||||||
|
|
||||||
expect(() => ErrorHandlingFileSystem.noExitOnFailure(
|
expect(() => ErrorHandlingFileSystem.noExitOnFailure(
|
||||||
() => file.writeAsStringSync('')), throwsA(isA<Exception>()));
|
() => file.writeAsStringSync('')), throwsException);
|
||||||
|
|
||||||
// nesting does not unconditionally re-enable errors.
|
// nesting does not unconditionally re-enable errors.
|
||||||
expect(() {
|
expect(() {
|
||||||
@ -221,10 +221,10 @@ void main() {
|
|||||||
ErrorHandlingFileSystem.noExitOnFailure(() { });
|
ErrorHandlingFileSystem.noExitOnFailure(() { });
|
||||||
file.writeAsStringSync('');
|
file.writeAsStringSync('');
|
||||||
});
|
});
|
||||||
}, throwsA(isA<Exception>()));
|
}, throwsException);
|
||||||
|
|
||||||
// Check that state does not leak.
|
// Check that state does not leak.
|
||||||
expect(() => file.writeAsStringSync(''), throwsA(isA<ToolExit>()));
|
expect(() => file.writeAsStringSync(''), throwsToolExit());
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('when access is denied', () async {
|
testWithoutContext('when access is denied', () async {
|
||||||
|
@ -227,7 +227,7 @@ void main() {
|
|||||||
|
|
||||||
expect(
|
expect(
|
||||||
() => asLogger<AppRunLogger>(notifyingLogger),
|
() => asLogger<AppRunLogger>(notifyingLogger),
|
||||||
throwsA(isA<StateError>()),
|
throwsStateError,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -335,8 +335,8 @@ void main() {
|
|||||||
logger.printStatus('message');
|
logger.printStatus('message');
|
||||||
logger.printError('error message');
|
logger.printError('error message');
|
||||||
|
|
||||||
expect(() async => stdout.done, throwsA(isA<Exception>()));
|
expect(() async => stdout.done, throwsException);
|
||||||
expect(() async => stderr.done, throwsA(isA<Exception>()));
|
expect(() async => stderr.done, throwsException);
|
||||||
});
|
});
|
||||||
|
|
||||||
group('Spinners', () {
|
group('Spinners', () {
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/base/common.dart';
|
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/base/os.dart';
|
import 'package:flutter_tools/src/base/os.dart';
|
||||||
@ -100,7 +99,7 @@ void main() {
|
|||||||
processManager: fakeProcessManager,
|
processManager: fakeProcessManager,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(() => utils.which(kExecutable), throwsA(isA<ToolExit>()));
|
expect(() => utils.which(kExecutable), throwsToolExit());
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('returns null when executable does not exist', () async {
|
testWithoutContext('returns null when executable does not exist', () async {
|
||||||
|
@ -35,8 +35,7 @@ void main() {
|
|||||||
exitCode: 1,
|
exitCode: 1,
|
||||||
));
|
));
|
||||||
|
|
||||||
expect(() async => processUtils.run(<String>['false'], throwOnError: true),
|
expect(() async => processUtils.run(<String>['false'], throwOnError: true), throwsProcessException());
|
||||||
throwsA(isA<ProcessException>()));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -124,8 +123,7 @@ void main() {
|
|||||||
],
|
],
|
||||||
exitCode: 1,
|
exitCode: 1,
|
||||||
));
|
));
|
||||||
expect(() => processUtils.run(<String>['kaboom'], throwOnError: true),
|
expect(() => processUtils.run(<String>['kaboom'], throwOnError: true), throwsProcessException());
|
||||||
throwsA(isA<ProcessException>()));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext(' does not throw on allowed Failures', () async {
|
testWithoutContext(' does not throw on allowed Failures', () async {
|
||||||
@ -158,7 +156,7 @@ void main() {
|
|||||||
throwOnError: true,
|
throwOnError: true,
|
||||||
allowedFailures: (int c) => c == 1,
|
allowedFailures: (int c) => c == 1,
|
||||||
),
|
),
|
||||||
throwsA(isA<ProcessException>()),
|
throwsProcessException(),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -269,7 +267,8 @@ void main() {
|
|||||||
throwOnError: true,
|
throwOnError: true,
|
||||||
allowedFailures: (int c) => c == 1,
|
allowedFailures: (int c) => c == 1,
|
||||||
),
|
),
|
||||||
throwsA(isA<ProcessException>()));
|
throwsProcessException(),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext(' prints stdout and stderr to trace on success', () async {
|
testWithoutContext(' prints stdout and stderr to trace on success', () async {
|
||||||
@ -294,8 +293,7 @@ void main() {
|
|||||||
stdout: 'stdout',
|
stdout: 'stdout',
|
||||||
stderr: 'stderr',
|
stderr: 'stderr',
|
||||||
));
|
));
|
||||||
expect(() => processUtils.runSync(<String>['kaboom'], throwOnError: true),
|
expect(() => processUtils.runSync(<String>['kaboom'], throwOnError: true), throwsProcessException());
|
||||||
throwsA(isA<ProcessException>()));
|
|
||||||
expect(testLogger.statusText, contains('stdout'));
|
expect(testLogger.statusText, contains('stdout'));
|
||||||
expect(testLogger.errorText, contains('stderr'));
|
expect(testLogger.errorText, contains('stderr'));
|
||||||
});
|
});
|
||||||
|
@ -110,8 +110,7 @@ flutter:
|
|||||||
|
|
||||||
''');
|
''');
|
||||||
|
|
||||||
expect(() async => const CopyAssets().build(environment),
|
expect(() async => const CopyAssets().build(environment), throwsException);
|
||||||
throwsA(isA<Exception>()));
|
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fileSystem,
|
FileSystem: () => fileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
@ -138,7 +137,7 @@ flutter:
|
|||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
engineVersion: null,
|
engineVersion: null,
|
||||||
), throwsA(isA<Exception>()));
|
), throwsException);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('processSkSLBundle throws exception if the bundle is not '
|
testWithoutContext('processSkSLBundle throws exception if the bundle is not '
|
||||||
@ -154,7 +153,7 @@ flutter:
|
|||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
logger: logger,
|
logger: logger,
|
||||||
engineVersion: null,
|
engineVersion: null,
|
||||||
), throwsA(isA<Exception>()));
|
), throwsException);
|
||||||
expect(logger.errorText, contains('was not a JSON object'));
|
expect(logger.errorText, contains('was not a JSON object'));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -171,7 +170,7 @@ flutter:
|
|||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
logger: logger,
|
logger: logger,
|
||||||
engineVersion: null,
|
engineVersion: null,
|
||||||
), throwsA(isA<Exception>()));
|
), throwsException);
|
||||||
expect(logger.errorText, contains('was not a JSON object'));
|
expect(logger.errorText, contains('was not a JSON object'));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -192,7 +191,7 @@ flutter:
|
|||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
logger: logger,
|
logger: logger,
|
||||||
engineVersion: '2',
|
engineVersion: '2',
|
||||||
), throwsA(isA<Exception>()));
|
), throwsException);
|
||||||
expect(logger.errorText, contains('Expected Flutter 1, but found 2'));
|
expect(logger.errorText, contains('Expected Flutter 1, but found 2'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -104,8 +104,7 @@ void main() {
|
|||||||
], exitCode: 1),
|
], exitCode: 1),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await expectLater(() => const KernelSnapshot().build(androidEnvironment),
|
await expectLater(() => const KernelSnapshot().build(androidEnvironment), throwsException);
|
||||||
throwsA(isA<Exception>()));
|
|
||||||
expect(processManager, hasNoRemainingExpectations);
|
expect(processManager, hasNoRemainingExpectations);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -434,8 +433,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('AotAssemblyProfile throws error if built for non-iOS platform', () async {
|
testUsingContext('AotAssemblyProfile throws error if built for non-iOS platform', () async {
|
||||||
expect(const AotAssemblyProfile().build(androidEnvironment),
|
expect(const AotAssemblyProfile().build(androidEnvironment), throwsException);
|
||||||
throwsA(isA<Exception>()));
|
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Platform: () => macPlatform,
|
Platform: () => macPlatform,
|
||||||
FileSystem: () => fileSystem,
|
FileSystem: () => fileSystem,
|
||||||
|
@ -64,7 +64,7 @@ void main() {
|
|||||||
'a.txt',
|
'a.txt',
|
||||||
],
|
],
|
||||||
clientSourcePaths: <String>['foo'],
|
clientSourcePaths: <String>['foo'],
|
||||||
), throwsA(isA<Exception>()));
|
), throwsException);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('unpackDesktopArtifacts throws when attempting to copy missing directory', () async {
|
testWithoutContext('unpackDesktopArtifacts throws when attempting to copy missing directory', () async {
|
||||||
@ -79,7 +79,7 @@ void main() {
|
|||||||
'a.txt',
|
'a.txt',
|
||||||
],
|
],
|
||||||
clientSourcePaths: <String>['foo'],
|
clientSourcePaths: <String>['foo'],
|
||||||
), throwsA(isA<Exception>()));
|
), throwsException);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('unpackDesktopArtifacts does not require a client source path', () async {
|
testWithoutContext('unpackDesktopArtifacts does not require a client source path', () async {
|
||||||
|
@ -225,7 +225,7 @@ void main() {
|
|||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(const AotAssemblyRelease().build(environment), throwsA(isA<Exception>()
|
expect(const AotAssemblyRelease().build(environment), throwsA(isException
|
||||||
.having(
|
.having(
|
||||||
(Exception exception) => exception.toString(),
|
(Exception exception) => exception.toString(),
|
||||||
'description',
|
'description',
|
||||||
@ -254,13 +254,11 @@ void main() {
|
|||||||
environment.defines[kBuildMode] = 'release';
|
environment.defines[kBuildMode] = 'release';
|
||||||
environment.defines[kIosArchs] = 'x86_64';
|
environment.defines[kIosArchs] = 'x86_64';
|
||||||
|
|
||||||
expect(const AotAssemblyRelease().build(environment), throwsA(isA<Exception>()
|
expect(const AotAssemblyRelease().build(environment), throwsA(isException.having(
|
||||||
.having(
|
(Exception exception) => exception.toString(),
|
||||||
(Exception exception) => exception.toString(),
|
|
||||||
'description',
|
'description',
|
||||||
contains('required define SdkRoot but it was not provided'),
|
contains('required define SdkRoot but it was not provided'),
|
||||||
)
|
)));
|
||||||
));
|
|
||||||
expect(processManager.hasRemainingExpectations, isFalse);
|
expect(processManager.hasRemainingExpectations, isFalse);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fileSystem,
|
FileSystem: () => fileSystem,
|
||||||
@ -371,7 +369,7 @@ void main() {
|
|||||||
processManager.addCommand(copyPhysicalFrameworkCommand);
|
processManager.addCommand(copyPhysicalFrameworkCommand);
|
||||||
await expectLater(
|
await expectLater(
|
||||||
const DebugUnpackIOS().build(environment),
|
const DebugUnpackIOS().build(environment),
|
||||||
throwsA(isA<Exception>().having(
|
throwsA(isException.having(
|
||||||
(Exception exception) => exception.toString(),
|
(Exception exception) => exception.toString(),
|
||||||
'description',
|
'description',
|
||||||
contains('Flutter.framework/Flutter does not exist, cannot thin'),
|
contains('Flutter.framework/Flutter does not exist, cannot thin'),
|
||||||
@ -412,12 +410,13 @@ void main() {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
await expectLater(
|
await expectLater(
|
||||||
const DebugUnpackIOS().build(environment),
|
const DebugUnpackIOS().build(environment),
|
||||||
throwsA(isA<Exception>().having(
|
throwsA(isException.having(
|
||||||
(Exception exception) => exception.toString(),
|
(Exception exception) => exception.toString(),
|
||||||
'description',
|
'description',
|
||||||
contains('does not contain arm64 armv7. Running lipo -info:\nArchitectures in the fat file:'),
|
contains('does not contain arm64 armv7. Running lipo -info:\nArchitectures in the fat file:'),
|
||||||
)));
|
)),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('fails when lipo extract fails', () async {
|
testWithoutContext('fails when lipo extract fails', () async {
|
||||||
@ -466,11 +465,12 @@ void main() {
|
|||||||
|
|
||||||
await expectLater(
|
await expectLater(
|
||||||
const DebugUnpackIOS().build(environment),
|
const DebugUnpackIOS().build(environment),
|
||||||
throwsA(isA<Exception>().having(
|
throwsA(isException.having(
|
||||||
(Exception exception) => exception.toString(),
|
(Exception exception) => exception.toString(),
|
||||||
'description',
|
'description',
|
||||||
contains('Failed to extract arm64 armv7 for output/Flutter.framework/Flutter.\nlipo error\nRunning lipo -info:\nArchitectures in the fat file:'),
|
contains('Failed to extract arm64 armv7 for output/Flutter.framework/Flutter.\nlipo error\nRunning lipo -info:\nArchitectures in the fat file:'),
|
||||||
)));
|
)),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('skips thin framework', () async {
|
testWithoutContext('skips thin framework', () async {
|
||||||
@ -581,12 +581,13 @@ void main() {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
await expectLater(
|
await expectLater(
|
||||||
const DebugUnpackIOS().build(environment),
|
const DebugUnpackIOS().build(environment),
|
||||||
throwsA(isA<Exception>().having(
|
throwsA(isException.having(
|
||||||
(Exception exception) => exception.toString(),
|
(Exception exception) => exception.toString(),
|
||||||
'description',
|
'description',
|
||||||
contains('Failed to strip bitcode for output/Flutter.framework/Flutter.\nbitcode_strip error'),
|
contains('Failed to strip bitcode for output/Flutter.framework/Flutter.\nbitcode_strip error'),
|
||||||
)));
|
)),
|
||||||
|
);
|
||||||
|
|
||||||
expect(processManager.hasRemainingExpectations, isFalse);
|
expect(processManager.hasRemainingExpectations, isFalse);
|
||||||
});
|
});
|
||||||
@ -653,12 +654,13 @@ void main() {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
await expectLater(
|
await expectLater(
|
||||||
const DebugUnpackIOS().build(environment),
|
const DebugUnpackIOS().build(environment),
|
||||||
throwsA(isA<Exception>().having(
|
throwsA(isException.having(
|
||||||
(Exception exception) => exception.toString(),
|
(Exception exception) => exception.toString(),
|
||||||
'description',
|
'description',
|
||||||
contains('Failed to codesign output/Flutter.framework/Flutter with identity ABC123.\ncodesign error'),
|
contains('Failed to codesign output/Flutter.framework/Flutter with identity ABC123.\ncodesign error'),
|
||||||
)));
|
)),
|
||||||
|
);
|
||||||
|
|
||||||
expect(processManager.hasRemainingExpectations, isFalse);
|
expect(processManager.hasRemainingExpectations, isFalse);
|
||||||
});
|
});
|
||||||
|
@ -96,7 +96,7 @@ use-deferred-loading: string
|
|||||||
file: configFile,
|
file: configFile,
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
),
|
),
|
||||||
throwsA(isA<Exception>()),
|
throwsException,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -105,12 +105,13 @@ void main() {
|
|||||||
testUsingContext('thinning fails when framework missing', () async {
|
testUsingContext('thinning fails when framework missing', () async {
|
||||||
processManager.addCommand(copyFrameworkCommand);
|
processManager.addCommand(copyFrameworkCommand);
|
||||||
await expectLater(
|
await expectLater(
|
||||||
const DebugUnpackMacOS().build(environment),
|
const DebugUnpackMacOS().build(environment),
|
||||||
throwsA(isA<Exception>().having(
|
throwsA(isException.having(
|
||||||
(Exception exception) => exception.toString(),
|
(Exception exception) => exception.toString(),
|
||||||
'description',
|
'description',
|
||||||
contains('FlutterMacOS.framework/FlutterMacOS does not exist, cannot thin'),
|
contains('FlutterMacOS.framework/FlutterMacOS does not exist, cannot thin'),
|
||||||
)));
|
)),
|
||||||
|
);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fileSystem,
|
FileSystem: () => fileSystem,
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
@ -132,12 +133,13 @@ void main() {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
await expectLater(
|
await expectLater(
|
||||||
const DebugUnpackMacOS().build(environment),
|
const DebugUnpackMacOS().build(environment),
|
||||||
throwsA(isA<Exception>().having(
|
throwsA(isException.having(
|
||||||
(Exception exception) => exception.toString(),
|
(Exception exception) => exception.toString(),
|
||||||
'description',
|
'description',
|
||||||
contains('does not contain arm64 x86_64. Running lipo -info:\nArchitectures in the fat file:'),
|
contains('does not contain arm64 x86_64. Running lipo -info:\nArchitectures in the fat file:'),
|
||||||
)));
|
)),
|
||||||
|
);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fileSystem,
|
FileSystem: () => fileSystem,
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
|
@ -290,7 +290,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
await expectLater(
|
await expectLater(
|
||||||
() => cache.updateAll(<DevelopmentArtifact>{null}),
|
() => cache.updateAll(<DevelopmentArtifact>{null}),
|
||||||
throwsA(isA<Exception>()),
|
throwsException,
|
||||||
);
|
);
|
||||||
verify(artifact1.update(any, any, any, any));
|
verify(artifact1.update(any, any, any, any));
|
||||||
// Don't continue when retrieval fails.
|
// Don't continue when retrieval fails.
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:fake_async/fake_async.dart';
|
import 'package:fake_async/fake_async.dart';
|
||||||
import 'package:flutter_tools/src/base/common.dart';
|
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/base/terminal.dart';
|
import 'package:flutter_tools/src/base/terminal.dart';
|
||||||
@ -336,7 +335,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
await expectLater(
|
await expectLater(
|
||||||
() async => deviceManager.findTargetDevices(FakeFlutterProject()),
|
() async => deviceManager.findTargetDevices(FakeFlutterProject()),
|
||||||
throwsA(isA<ToolExit>())
|
throwsToolExit(),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -516,8 +516,8 @@ void main() {
|
|||||||
);
|
);
|
||||||
when(mockXcdevice.isInstalled).thenReturn(false);
|
when(mockXcdevice.isInstalled).thenReturn(false);
|
||||||
expect(
|
expect(
|
||||||
() async { await iosDevices.pollingGetDevices(); },
|
() async { await iosDevices.pollingGetDevices(); },
|
||||||
throwsA(isA<UnsupportedError>()),
|
throwsUnsupportedError,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
() async => portDiscovery.query(),
|
() async => portDiscovery.query(),
|
||||||
throwsA(isA<Exception>()),
|
throwsException,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ void main() {
|
|||||||
usage: TestUsage(),
|
usage: TestUsage(),
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(() async => residentWebRunner.run(), throwsA(isA<Exception>()));
|
expect(() async => residentWebRunner.run(), throwsException);
|
||||||
expect(await residentWebRunner.waitForAppToFinish(), 1);
|
expect(await residentWebRunner.waitForAppToFinish(), 1);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
BuildSystem: () => TestBuildSystem.error(Exception('foo')),
|
BuildSystem: () => TestBuildSystem.error(Exception('foo')),
|
||||||
|
@ -212,7 +212,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
await expectLater(
|
await expectLater(
|
||||||
() => flutterCommand.run(),
|
() => flutterCommand.run(),
|
||||||
throwsA(isA<ToolExit>()),
|
throwsToolExit(),
|
||||||
);
|
);
|
||||||
expect(usage.events, <TestUsageEvent>[
|
expect(usage.events, <TestUsageEvent>[
|
||||||
const TestUsageEvent(
|
const TestUsageEvent(
|
||||||
@ -436,7 +436,7 @@ void main() {
|
|||||||
|
|
||||||
await expectLater(
|
await expectLater(
|
||||||
() => flutterCommand.run(),
|
() => flutterCommand.run(),
|
||||||
throwsA(isA<ToolExit>()),
|
throwsToolExit(),
|
||||||
);
|
);
|
||||||
expect(usage.timings, contains(
|
expect(usage.timings, contains(
|
||||||
const TestTimingEvent(
|
const TestTimingEvent(
|
||||||
|
@ -96,7 +96,7 @@ void main() {
|
|||||||
ProcessUtils: () => null,
|
ProcessUtils: () => null,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(() => testbed.run(() {}), throwsA(isA<StateError>()));
|
expect(() => testbed.run(() {}), throwsStateError);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user