Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
7d46d436
Unverified
Commit
7d46d436
authored
May 12, 2021
by
Alexandre Ardhuin
Committed by
GitHub
May 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use throwsXxx instead of throwsA(isA<Xxx>()) (#82328)
parent
ab2aa319
Changes
40
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
133 additions
and
154 deletions
+133
-154
bottom_tab_bar_test.dart
packages/flutter/test/cupertino/bottom_tab_bar_test.dart
+1
-1
segmented_control_test.dart
packages/flutter/test/cupertino/segmented_control_test.dart
+3
-3
sliding_segmented_control_test.dart
...lutter/test/cupertino/sliding_segmented_control_test.dart
+3
-3
dropdown_form_field_test.dart
packages/flutter/test/material/dropdown_form_field_test.dart
+2
-2
dropdown_test.dart
packages/flutter/test/material/dropdown_test.dart
+2
-2
toggle_buttons_test.dart
packages/flutter/test/material/toggle_buttons_test.dart
+1
-1
box_test.dart
packages/flutter/test/rendering/box_test.dart
+2
-2
restoration_bucket_test.dart
packages/flutter/test/services/restoration_bucket_test.dart
+1
-1
grid_view_test.dart
packages/flutter/test/widgets/grid_view_test.dart
+1
-1
list_wheel_scroll_view_test.dart
...ges/flutter/test/widgets/list_wheel_scroll_view_test.dart
+1
-1
page_view_test.dart
packages/flutter/test/widgets/page_view_test.dart
+2
-2
flutter_driver_test.dart
...utter_driver/test/src/real_tests/flutter_driver_test.dart
+11
-20
io_extension_test.dart
...flutter_driver/test/src/real_tests/io_extension_test.dart
+1
-2
goldens_test.dart
packages/flutter_test/test/goldens_test.dart
+5
-5
build_test.dart
...lutter_tools/test/commands.shard/hermetic/build_test.dart
+2
-2
generate_localizations_test.dart
.../commands.shard/hermetic/generate_localizations_test.dart
+2
-2
run_test.dart
.../flutter_tools/test/commands.shard/hermetic/run_test.dart
+4
-8
screenshot_command_test.dart
...test/commands.shard/hermetic/screenshot_command_test.dart
+2
-2
test_test.dart
...flutter_tools/test/commands.shard/hermetic/test_test.dart
+1
-2
android_device_port_forwarder_test.dart
...ral.shard/android/android_device_port_forwarder_test.dart
+2
-3
android_gradle_builder_test.dart
...st/general.shard/android/android_gradle_builder_test.dart
+2
-3
artifact_updater_test.dart
...utter_tools/test/general.shard/artifact_updater_test.dart
+3
-4
common_test.dart
...es/flutter_tools/test/general.shard/base/common_test.dart
+1
-1
error_handling_io_test.dart
...tools/test/general.shard/base/error_handling_io_test.dart
+5
-5
logger_test.dart
...es/flutter_tools/test/general.shard/base/logger_test.dart
+3
-3
os_test.dart
packages/flutter_tools/test/general.shard/base/os_test.dart
+1
-2
process_test.dart
...s/flutter_tools/test/general.shard/base/process_test.dart
+6
-8
assets_test.dart
.../test/general.shard/build_system/targets/assets_test.dart
+5
-6
common_test.dart
.../test/general.shard/build_system/targets/common_test.dart
+2
-4
desktop_test.dart
...test/general.shard/build_system/targets/desktop_test.dart
+2
-2
ios_test.dart
...ols/test/general.shard/build_system/targets/ios_test.dart
+30
-28
localizations_test.dart
...eneral.shard/build_system/targets/localizations_test.dart
+1
-1
macos_test.dart
...s/test/general.shard/build_system/targets/macos_test.dart
+14
-12
cache_test.dart
packages/flutter_tools/test/general.shard/cache_test.dart
+1
-1
device_test.dart
packages/flutter_tools/test/general.shard/device_test.dart
+1
-2
devices_test.dart
...es/flutter_tools/test/general.shard/ios/devices_test.dart
+2
-2
mdns_discovery_test.dart
...flutter_tools/test/general.shard/mdns_discovery_test.dart
+1
-1
resident_web_runner_cold_test.dart
...ols/test/general.shard/resident_web_runner_cold_test.dart
+1
-1
flutter_command_test.dart
...tools/test/general.shard/runner/flutter_command_test.dart
+2
-2
testbed_test.dart
packages/flutter_tools/test/general.shard/testbed_test.dart
+1
-1
No files found.
packages/flutter/test/cupertino/bottom_tab_bar_test.dart
View file @
7d46d436
...
...
@@ -39,7 +39,7 @@ Future<void> main() async {
),
],
)),
throwsA
(
isA
<
AssertionError
>()
.
having
(
throwsA
(
isA
ssertionError
.
having
(
(
AssertionError
error
)
=>
error
.
toString
(),
'.toString()'
,
contains
(
'items.length'
),
...
...
packages/flutter/test/cupertino/segmented_control_test.dart
View file @
7d46d436
...
...
@@ -94,7 +94,7 @@ void main() {
),
),
),
throwsA
(
isA
<
AssertionError
>()
.
having
(
throwsA
(
isA
ssertionError
.
having
(
(
AssertionError
error
)
=>
error
.
toString
(),
'.toString()'
,
contains
(
'children.length'
),
...
...
@@ -110,7 +110,7 @@ void main() {
),
),
),
throwsA
(
isA
<
AssertionError
>()
.
having
(
throwsA
(
isA
ssertionError
.
having
(
(
AssertionError
error
)
=>
error
.
toString
(),
'.toString()'
,
contains
(
'children.length'
),
...
...
@@ -220,7 +220,7 @@ void main() {
),
),
),
throwsA
(
isA
<
AssertionError
>()
.
having
(
throwsA
(
isA
ssertionError
.
having
(
(
AssertionError
error
)
=>
error
.
toString
(),
'.toString()'
,
contains
(
'children'
),
...
...
packages/flutter/test/cupertino/sliding_segmented_control_test.dart
View file @
7d46d436
...
...
@@ -82,7 +82,7 @@ void main() {
onValueChanged:
defaultCallback
,
),
),
throwsA
(
isA
<
AssertionError
>()
.
having
(
throwsA
(
isA
ssertionError
.
having
(
(
AssertionError
error
)
=>
error
.
toString
(),
'.toString()'
,
contains
(
'children.length'
),
...
...
@@ -97,7 +97,7 @@ void main() {
onValueChanged:
defaultCallback
,
),
),
throwsA
(
isA
<
AssertionError
>()
.
having
(
throwsA
(
isA
ssertionError
.
having
(
(
AssertionError
error
)
=>
error
.
toString
(),
'.toString()'
,
contains
(
'children.length'
),
...
...
@@ -117,7 +117,7 @@ void main() {
onValueChanged:
defaultCallback
,
),
),
throwsA
(
isA
<
AssertionError
>()
.
having
(
throwsA
(
isA
ssertionError
.
having
(
(
AssertionError
error
)
=>
error
.
toString
(),
'.toString()'
,
contains
(
'groupValue must be either null or one of the keys in the children map'
),
...
...
packages/flutter/test/material/dropdown_form_field_test.dart
View file @
7d46d436
...
...
@@ -588,7 +588,7 @@ void main() {
),
),
),
throwsA
(
isA
<
AssertionError
>()
.
having
(
throwsA
(
isA
ssertionError
.
having
(
(
AssertionError
error
)
=>
error
.
toString
(),
'.toString()'
,
contains
(
"There should be exactly one item with [DropdownButton]'s value"
),
...
...
@@ -617,7 +617,7 @@ void main() {
),
),
),
throwsA
(
isA
<
AssertionError
>()
.
having
(
throwsA
(
isA
ssertionError
.
having
(
(
AssertionError
error
)
=>
error
.
toString
(),
'.toString()'
,
contains
(
"There should be exactly one item with [DropdownButton]'s value"
),
...
...
packages/flutter/test/material/dropdown_test.dart
View file @
7d46d436
...
...
@@ -457,7 +457,7 @@ void main() {
),
),
),
throwsA
(
isA
<
AssertionError
>()
.
having
(
throwsA
(
isA
ssertionError
.
having
(
(
AssertionError
error
)
=>
error
.
toString
(),
'.toString()'
,
contains
(
"There should be exactly one item with [DropdownButton]'s value"
),
...
...
@@ -486,7 +486,7 @@ void main() {
),
),
),
throwsA
(
isA
<
AssertionError
>()
.
having
(
throwsA
(
isA
ssertionError
.
having
(
(
AssertionError
error
)
=>
error
.
toString
(),
'.toString()'
,
contains
(
"There should be exactly one item with [DropdownButton]'s value"
),
...
...
packages/flutter/test/material/toggle_buttons_test.dart
View file @
7d46d436
...
...
@@ -185,7 +185,7 @@ void main() {
),
),
),
throwsA
(
isA
<
AssertionError
>()
.
having
(
throwsA
(
isA
ssertionError
.
having
(
(
AssertionError
error
)
=>
error
.
toString
(),
'.toString()'
,
allOf
(
...
...
packages/flutter/test/rendering/box_test.dart
View file @
7d46d436
...
...
@@ -980,7 +980,7 @@ void main() {
},
);
},
throwsA
(
isA
<
AssertionError
>()
.
having
(
throwsA
(
isA
ssertionError
.
having
(
(
AssertionError
error
)
=>
error
.
message
,
'message'
,
'paintTransform must be invertible.'
,
...
...
@@ -996,7 +996,7 @@ void main() {
},
);
},
throwsA
(
isA
<
AssertionError
>()
.
having
(
throwsA
(
isA
ssertionError
.
having
(
(
AssertionError
error
)
=>
error
.
message
,
'message'
,
'Exactly one transform or offset argument must be provided.'
,
...
...
packages/flutter/test/services/restoration_bucket_test.dart
View file @
7d46d436
...
...
@@ -183,7 +183,7 @@ void main() {
// child1 is not given up before running finalizers.
expect
(
()
=>
manager
.
doSerialization
(),
throwsA
(
is
A
<
FlutterError
>()
.
having
(
throwsA
(
is
FlutterError
.
having
(
(
FlutterError
error
)
=>
error
.
message
,
'message'
,
equals
(
...
...
packages/flutter/test/widgets/grid_view_test.dart
View file @
7d46d436
...
...
@@ -768,7 +768,7 @@ void main() {
child:
GridView
.
extent
(
maxCrossAxisExtent:
maxCrossAxisExtent
,
),
),
throwsA
(
isA
<
AssertionError
>())
);
),
throwsA
ssertionError
);
});
}
packages/flutter/test/widgets/list_wheel_scroll_view_test.dart
View file @
7d46d436
...
...
@@ -56,7 +56,7 @@ void main() {
itemExtent:
20.0
,
children:
const
<
Widget
>[],
),
throwsA
(
isA
<
AssertionError
>()
.
having
(
throwsA
(
isA
ssertionError
.
having
(
(
AssertionError
error
)
=>
error
.
message
,
'message'
,
contains
(
"You can't set a diameterRatio of 0"
),
...
...
packages/flutter/test/widgets/page_view_test.dart
View file @
7d46d436
...
...
@@ -758,7 +758,7 @@ void main() {
final
PageController
controller
=
PageController
();
expect
(
()
=>
controller
.
page
,
throwsA
(
isA
<
AssertionError
>()
.
having
(
throwsA
(
isA
ssertionError
.
having
(
(
AssertionError
error
)
=>
error
.
message
,
'message'
,
equals
(
'PageController.page cannot be accessed before a PageView is built with it.'
),
...
...
@@ -792,7 +792,7 @@ void main() {
);
expect
(
()
=>
controller
.
page
,
throwsA
(
isA
<
AssertionError
>()
.
having
(
throwsA
(
isA
ssertionError
.
having
(
(
AssertionError
error
)
=>
error
.
message
,
'message'
,
equals
(
'PageController.page cannot be accessed before a PageView is built with it.'
),
...
...
packages/flutter_driver/test/src/real_tests/flutter_driver_test.dart
View file @
7d46d436
...
...
@@ -632,11 +632,11 @@ void main() {
group
(
'VMServiceFlutterDriver Unsupported error'
,
()
{
test
(
'enableAccessibility'
,
()
async
{
expect
(
driver
.
enableAccessibility
(),
throws
A
(
isA
<
UnsupportedError
>())
);
expect
(
driver
.
enableAccessibility
(),
throws
UnsupportedError
);
});
test
(
'webDriver'
,
()
async
{
expect
(()
=>
driver
.
webDriver
,
throws
A
(
isA
<
UnsupportedError
>())
);
expect
(()
=>
driver
.
webDriver
,
throws
UnsupportedError
);
});
});
});
...
...
@@ -913,28 +913,23 @@ void main() {
group
(
'WebFlutterDriver Unimplemented/Unsupported error'
,
()
{
test
(
'forceGC'
,
()
async
{
expect
(
driver
.
forceGC
(),
throwsA
(
isA
<
UnimplementedError
>()));
expect
(
driver
.
forceGC
(),
throwsUnimplementedError
);
});
test
(
'getVmFlags'
,
()
async
{
expect
(
driver
.
getVmFlags
(),
throwsA
(
isA
<
UnimplementedError
>()));
expect
(
driver
.
getVmFlags
(),
throwsUnimplementedError
);
});
test
(
'waitUntilFirstFrameRasterized'
,
()
async
{
expect
(
driver
.
waitUntilFirstFrameRasterized
(),
throwsA
(
isA
<
UnimplementedError
>()));
expect
(
driver
.
waitUntilFirstFrameRasterized
(),
throwsUnimplementedError
);
});
test
(
'appIsoloate'
,
()
async
{
expect
(()
=>
driver
.
appIsolate
.
extensionRPCs
,
throwsA
(
isA
<
UnsupportedError
>()));
expect
(()
=>
driver
.
appIsolate
.
extensionRPCs
,
throwsUnsupportedError
);
});
test
(
'serviceClient'
,
()
async
{
expect
(()
=>
driver
.
serviceClient
.
getVM
(),
throwsA
(
isA
<
UnsupportedError
>()));
expect
(()
=>
driver
.
serviceClient
.
getVM
(),
throwsUnsupportedError
);
});
});
});
...
...
@@ -949,14 +944,10 @@ void main() {
});
test
(
'tracing'
,
()
async
{
expect
(
driver
.
traceAction
(()
async
{
return
Future
<
dynamic
>.
value
();
}),
throwsA
(
isA
<
UnsupportedError
>()));
expect
(
driver
.
startTracing
(),
throwsA
(
isA
<
UnsupportedError
>()));
expect
(
driver
.
stopTracingAndDownloadTimeline
(),
throwsA
(
isA
<
UnsupportedError
>()));
expect
(
driver
.
clearTimeline
(),
throwsA
(
isA
<
UnsupportedError
>()));
expect
(
driver
.
traceAction
(()
async
{
return
Future
<
dynamic
>.
value
();
}),
throwsUnsupportedError
);
expect
(
driver
.
startTracing
(),
throwsUnsupportedError
);
expect
(
driver
.
stopTracingAndDownloadTimeline
(),
throwsUnsupportedError
);
expect
(
driver
.
clearTimeline
(),
throwsUnsupportedError
);
});
});
}
...
...
packages/flutter_driver/test/src/real_tests/io_extension_test.dart
View file @
7d46d436
...
...
@@ -17,8 +17,7 @@ void main() {
});
test
(
'io_extension should throw exception'
,
()
{
expect
(()
=>
registerWebServiceExtension
(
call
),
throwsA
(
isA
<
UnsupportedError
>()));
expect
(()
=>
registerWebServiceExtension
(
call
),
throwsUnsupportedError
);
});
});
}
packages/flutter_test/test/goldens_test.dart
View file @
7d46d436
...
...
@@ -185,7 +185,7 @@ void main() {
await
fs
.
file
(
fix
(
'/golden.png'
)).
writeAsBytes
(
_kColorFailurePngBytes
);
await
expectLater
(
()
=>
doComparison
(),
throwsA
(
is
A
<
FlutterError
>()
.
having
(
throwsA
(
is
FlutterError
.
having
(
(
FlutterError
error
)
=>
error
.
message
,
'message'
,
contains
(
'% diff detected'
),
...
...
@@ -216,7 +216,7 @@ void main() {
..
writeAsBytesSync
(
_kColorFailurePngBytes
);
await
expectLater
(
()
=>
doComparison
(
'subdir/golden.png'
),
throwsA
(
is
A
<
FlutterError
>()
.
having
(
throwsA
(
is
FlutterError
.
having
(
(
FlutterError
error
)
=>
error
.
message
,
'message'
,
contains
(
'% diff detected'
),
...
...
@@ -255,7 +255,7 @@ void main() {
await
fs
.
file
(
fix
(
'/golden.png'
)).
writeAsBytes
(
_kSizeFailurePngBytes
);
await
expectLater
(
()
=>
doComparison
(),
throwsA
(
is
A
<
FlutterError
>()
.
having
(
throwsA
(
is
FlutterError
.
having
(
(
FlutterError
error
)
=>
error
.
message
,
'message'
,
contains
(
'image sizes do not match'
),
...
...
@@ -267,7 +267,7 @@ void main() {
await
fs
.
file
(
fix
(
'/golden.png'
)).
writeAsBytes
(
_kColorFailurePngBytes
);
await
expectLater
(
()
=>
doComparison
(),
throwsA
(
is
A
<
FlutterError
>()
.
having
(
throwsA
(
is
FlutterError
.
having
(
(
FlutterError
error
)
=>
error
.
message
,
'message'
,
contains
(
'% diff detected'
),
...
...
@@ -279,7 +279,7 @@ void main() {
await
fs
.
file
(
fix
(
'/golden.png'
)).
writeAsBytes
(<
int
>[]);
await
expectLater
(
()
=>
doComparison
(),
throwsA
(
is
A
<
FlutterError
>()
.
having
(
throwsA
(
is
FlutterError
.
having
(
(
FlutterError
error
)
=>
error
.
message
,
'message'
,
contains
(
'null image provided'
),
...
...
packages/flutter_tools/test/commands.shard/hermetic/build_test.dart
View file @
7d46d436
...
...
@@ -5,9 +5,9 @@
// @dart = 2.8
import
'package:args/command_runner.dart'
;
import
'package:flutter_tools/src/base/common.dart'
;
import
'package:flutter_tools/src/runner/flutter_command.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/test_flutter_command_runner.dart'
;
...
...
@@ -19,7 +19,7 @@ void main() {
expect
(()
=>
commandRunner
.
run
(<
String
>[
'build'
,
'--obfuscate'
,
]),
throws
A
(
isA
<
ToolExit
>()
));
]),
throws
ToolExit
(
));
});
}
...
...
packages/flutter_tools/test/commands.shard/hermetic/generate_localizations_test.dart
View file @
7d46d436
...
...
@@ -5,13 +5,13 @@
// @dart = 2.8
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/logger.dart'
;
import
'package:flutter_tools/src/commands/generate_localizations.dart'
;
import
'package:flutter_tools/src/runner/flutter_command.dart'
;
import
'../../integration.shard/test_data/basic_project.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/test_flutter_command_runner.dart'
;
...
...
@@ -100,7 +100,7 @@ void main() {
'--header="some header'
,
'--header-file="header.txt"'
,
]),
throws
A
(
isA
<
ToolExit
>()
),
throws
ToolExit
(
),
);
});
...
...
packages/flutter_tools/test/commands.shard/hermetic/run_test.dart
View file @
7d46d436
...
...
@@ -75,7 +75,7 @@ void main() {
'--no-pub'
,
'--show-test-device'
,
]),
throwsA
(
is
A
<
Exception
>()
.
having
(
throwsA
(
is
Exception
.
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
'toString'
,
isNot
(
contains
(
'--fast-start is not supported with --use-application-binary'
)),
...
...
@@ -102,7 +102,7 @@ void main() {
'run'
,
'--no-pub'
,
]),
throws
A
(
isA
<
ToolExit
>()
),
throws
ToolExit
(
),
);
final
BufferLogger
bufferLogger
=
globals
.
logger
as
BufferLogger
;
expect
(
...
...
@@ -127,11 +127,7 @@ void main() {
'run'
,
'--no-pub'
,
]),
throwsA
(
isA
<
ToolExit
>().
having
(
(
ToolExit
error
)
=>
error
.
toString
(),
'toString()'
,
contains
(
'No pubspec.yaml file found'
),
)),
throwsToolExit
(
message:
'No pubspec.yaml file found'
),
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
...
...
@@ -510,7 +506,7 @@ void main() {
'run'
,
'--no-pub'
,
'--bundle-sksl-path=foo.json'
,
]),
throws
A
(
isA
<
ToolExit
>().
having
((
ToolExit
exit
)
=>
exit
.
message
,
'message'
,
contains
(
'No SkSL shader bundle found at foo.json'
))
));
]),
throws
ToolExit
(
message:
'No SkSL shader bundle found at foo.json'
));
});
}
...
...
packages/flutter_tools/test/commands.shard/hermetic/screenshot_command_test.dart
View file @
7d46d436
...
...
@@ -30,12 +30,12 @@ void main() {
await
expectLater
(()
=>
createTestCommandRunner
(
ScreenshotCommand
())
.
run
(<
String
>[
'screenshot'
,
'--type=skia'
,
'--observatory-url=http://localhost:8181'
]),
throwsA
(
is
A
<
Exception
>().
having
((
dynamic
exception
)
=>
exception
.
toString
(),
'message'
,
contains
(
'dummy'
))),
throwsA
(
is
Exception
.
having
((
Exception
exception
)
=>
exception
.
toString
(),
'message'
,
contains
(
'dummy'
))),
);
await
expectLater
(()
=>
createTestCommandRunner
(
ScreenshotCommand
())
.
run
(<
String
>[
'screenshot'
,
'--type=rasterizer'
,
'--observatory-url=http://localhost:8181'
]),
throwsA
(
is
A
<
Exception
>().
having
((
dynamic
exception
)
=>
exception
.
toString
(),
'message'
,
contains
(
'dummy'
))),
throwsA
(
is
Exception
.
having
((
Exception
exception
)
=>
exception
.
toString
(),
'message'
,
contains
(
'dummy'
))),
);
});
...
...
packages/flutter_tools/test/commands.shard/hermetic/test_test.dart
View file @
7d46d436
...
...
@@ -211,8 +211,7 @@ dev_dependencies:
'--coverage'
,
'--'
,
'test/fake_test.dart'
,
]),
throwsA
(
isA
<
ToolExit
>()
.
having
((
ToolExit
toolExit
)
=>
toolExit
.
message
,
'message'
,
isNull
)));
]),
throwsA
(
isA
<
ToolExit
>().
having
((
ToolExit
toolExit
)
=>
toolExit
.
message
,
'message'
,
isNull
)));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
...
...
packages/flutter_tools/test/general.shard/android/android_device_port_forwarder_test.dart
View file @
7d46d436
...
...
@@ -5,7 +5,6 @@
// @dart = 2.8
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/device_port_forwarder.dart'
;
...
...
@@ -78,7 +77,7 @@ void main() {
logger:
BufferLogger
.
test
(),
);
expect
(
forwarder
.
forward
(
123
,
hostPort:
456
),
throws
A
(
isA
<
ProcessException
>()
));
expect
(
forwarder
.
forward
(
123
,
hostPort:
456
),
throws
ProcessException
(
));
});
testWithoutContext
(
'AndroidDevicePortForwarder forwardedPorts returns empty '
...
...
@@ -159,6 +158,6 @@ void main() {
logger:
BufferLogger
.
test
(),
);
expect
(()
=>
forwarder
.
unforward
(
ForwardedPort
(
456
,
23
)),
throws
A
(
isA
<
ProcessException
>()
));
expect
(()
=>
forwarder
.
unforward
(
ForwardedPort
(
456
,
23
)),
throws
ProcessException
(
));
});
}
packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart
View file @
7d46d436
...
...
@@ -358,7 +358,7 @@ void main() {
..
writeAsStringSync
(
'apply from: irrelevant/flutter.gradle'
);
await
expectLater
(()
async
{
await
builder
.
buildGradleApp
(
await
builder
.
buildGradleApp
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
...
...
@@ -371,8 +371,7 @@ void main() {
isBuildingBundle:
false
,
localGradleErrors:
const
<
GradleHandledError
>[],
);
},
throwsA
(
isA
<
ProcessException
>()));
},
throwsProcessException
());
expect
(
processManager
,
hasNoRemainingExpectations
);
});
...
...
packages/flutter_tools/test/general.shard/artifact_updater_test.dart
View file @
7d46d436
...
...
@@ -4,7 +4,6 @@
import
'package:file/memory.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/io.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
...
...
@@ -288,7 +287,7 @@ void main() {
'test message'
,
Uri
.
parse
(
'http://test.zip'
),
fileSystem
.
currentDirectory
.
childDirectory
(
'out'
),
),
throwsA
(
isA
<
ArgumentError
>())
);
),
throwsA
rgumentError
);
expect
(
logger
.
statusText
,
contains
(
'test message'
));
expect
(
fileSystem
.
file
(
'out/test'
),
isNot
(
exists
));
...
...
@@ -361,7 +360,7 @@ void main() {
'test message'
,
Uri
.
parse
(
'http://test.zip'
),
fileSystem
.
currentDirectory
.
childDirectory
(
'out'
),
),
throws
A
(
isA
<
ToolExit
>()
));
),
throws
ToolExit
(
));
expect
(
fileSystem
.
file
(
'te,[/test'
),
isNot
(
exists
));
expect
(
fileSystem
.
file
(
'out/test'
),
isNot
(
exists
));
});
...
...
@@ -385,7 +384,7 @@ void main() {
'test message'
,
Uri
.
parse
(
'http://test.zip'
),
fileSystem
.
currentDirectory
.
childDirectory
(
'out'
),
),
throws
A
(
isA
<
ToolExit
>()
));
),
throws
ToolExit
(
));
expect
(
fileSystem
.
file
(
'te,[/test'
),
isNot
(
exists
));
expect
(
fileSystem
.
file
(
'out/test'
),
isNot
(
exists
));
});
...
...
packages/flutter_tools/test/general.shard/base/common_test.dart
View file @
7d46d436
...
...
@@ -26,7 +26,7 @@ void main() {
});
testWithoutContext
(
'Throws if accessing the Zone'
,
()
{
expect
(()
=>
context
.
get
<
Object
>(),
throws
A
(
isA
<
UnsupportedError
>())
);
expect
(()
=>
context
.
get
<
Object
>(),
throws
UnsupportedError
);
});
});
}
packages/flutter_tools/test/general.shard/base/error_handling_io_test.dart
View file @
7d46d436
...
...
@@ -168,7 +168,7 @@ void main() {
when
(
file
.
deleteSync
(
recursive:
false
))
.
thenThrow
(
const
FileSystemException
(
''
,
''
,
OSError
(
''
,
2
)));
expect
(()
=>
ErrorHandlingFileSystem
.
deleteIfExists
(
file
),
throws
A
(
isA
<
ToolExit
>()
));
expect
(()
=>
ErrorHandlingFileSystem
.
deleteIfExists
(
file
),
throws
ToolExit
(
));
});
testWithoutContext
(
'deleteIfExists does not tool exit if file exists on read-only '
...
...
@@ -182,7 +182,7 @@ void main() {
ErrorHandlingFileSystem
.
noExitOnFailure
(()
{
ErrorHandlingFileSystem
.
deleteIfExists
(
file
);
});
},
throws
A
(
isA
<
FileSystemException
>()
));
},
throws
FileSystemException
(
));
});
group
(
'throws ToolExit on Windows'
,
()
{
...
...
@@ -213,7 +213,7 @@ void main() {
final
File
file
=
fs
.
file
(
'file'
);
expect
(()
=>
ErrorHandlingFileSystem
.
noExitOnFailure
(
()
=>
file
.
writeAsStringSync
(
''
)),
throws
A
(
isA
<
Exception
>())
);
()
=>
file
.
writeAsStringSync
(
''
)),
throws
Exception
);
// nesting does not unconditionally re-enable errors.
expect
(()
{
...
...
@@ -221,10 +221,10 @@ void main() {
ErrorHandlingFileSystem
.
noExitOnFailure
(()
{
});
file
.
writeAsStringSync
(
''
);
});
},
throws
A
(
isA
<
Exception
>())
);
},
throws
Exception
);
// Check that state does not leak.
expect
(()
=>
file
.
writeAsStringSync
(
''
),
throws
A
(
isA
<
ToolExit
>()
));
expect
(()
=>
file
.
writeAsStringSync
(
''
),
throws
ToolExit
(
));
});
testWithoutContext
(
'when access is denied'
,
()
async
{
...
...
packages/flutter_tools/test/general.shard/base/logger_test.dart
View file @
7d46d436
...
...
@@ -227,7 +227,7 @@ void main() {
expect
(
()
=>
asLogger
<
AppRunLogger
>(
notifyingLogger
),
throws
A
(
isA
<
StateError
>())
,
throws
StateError
,
);
});
...
...
@@ -335,8 +335,8 @@ void main() {
logger
.
printStatus
(
'message'
);
logger
.
printError
(
'error message'
);
expect
(()
async
=>
stdout
.
done
,
throws
A
(
isA
<
Exception
>())
);
expect
(()
async
=>
stderr
.
done
,
throws
A
(
isA
<
Exception
>())
);
expect
(()
async
=>
stdout
.
done
,
throws
Exception
);
expect
(()
async
=>
stderr
.
done
,
throws
Exception
);
});
group
(
'Spinners'
,
()
{
...
...
packages/flutter_tools/test/general.shard/base/os_test.dart
View file @
7d46d436
...
...
@@ -4,7 +4,6 @@
import
'package:file/file.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/logger.dart'
;
import
'package:flutter_tools/src/base/os.dart'
;
...
...
@@ -100,7 +99,7 @@ void main() {
processManager:
fakeProcessManager
,
);
expect
(()
=>
utils
.
which
(
kExecutable
),
throws
A
(
isA
<
ToolExit
>()
));
expect
(()
=>
utils
.
which
(
kExecutable
),
throws
ToolExit
(
));
});
testWithoutContext
(
'returns null when executable does not exist'
,
()
async
{
...
...
packages/flutter_tools/test/general.shard/base/process_test.dart
View file @
7d46d436
...
...
@@ -35,8 +35,7 @@ void main() {
exitCode:
1
,
));
expect
(()
async
=>
processUtils
.
run
(<
String
>[
'false'
],
throwOnError:
true
),
throwsA
(
isA
<
ProcessException
>()));
expect
(()
async
=>
processUtils
.
run
(<
String
>[
'false'
],
throwOnError:
true
),
throwsProcessException
());
});
});
...
...
@@ -124,8 +123,7 @@ void main() {
],
exitCode:
1
,
));
expect
(()
=>
processUtils
.
run
(<
String
>[
'kaboom'
],
throwOnError:
true
),
throwsA
(
isA
<
ProcessException
>()));
expect
(()
=>
processUtils
.
run
(<
String
>[
'kaboom'
],
throwOnError:
true
),
throwsProcessException
());
});
testWithoutContext
(
' does not throw on allowed Failures'
,
()
async
{
...
...
@@ -158,7 +156,7 @@ void main() {
throwOnError:
true
,
allowedFailures:
(
int
c
)
=>
c
==
1
,
),
throws
A
(
isA
<
ProcessException
>()
),
throws
ProcessException
(
),
);
});
});
...
...
@@ -269,7 +267,8 @@ void main() {
throwOnError:
true
,
allowedFailures:
(
int
c
)
=>
c
==
1
,
),
throwsA
(
isA
<
ProcessException
>()));
throwsProcessException
(),
);
});
testWithoutContext
(
' prints stdout and stderr to trace on success'
,
()
async
{
...
...
@@ -294,8 +293,7 @@ void main() {
stdout:
'stdout'
,
stderr:
'stderr'
,
));
expect
(()
=>
processUtils
.
runSync
(<
String
>[
'kaboom'
],
throwOnError:
true
),
throwsA
(
isA
<
ProcessException
>()));
expect
(()
=>
processUtils
.
runSync
(<
String
>[
'kaboom'
],
throwOnError:
true
),
throwsProcessException
());
expect
(
testLogger
.
statusText
,
contains
(
'stdout'
));
expect
(
testLogger
.
errorText
,
contains
(
'stderr'
));
});
...
...
packages/flutter_tools/test/general.shard/build_system/targets/assets_test.dart
View file @
7d46d436
...
...
@@ -110,8 +110,7 @@ flutter:
'''
);
expect
(()
async
=>
const
CopyAssets
().
build
(
environment
),
throwsA
(
isA
<
Exception
>()));
expect
(()
async
=>
const
CopyAssets
().
build
(
environment
),
throwsException
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
...
...
@@ -138,7 +137,7 @@ flutter:
fileSystem:
MemoryFileSystem
.
test
(),
logger:
BufferLogger
.
test
(),
engineVersion:
null
,
),
throws
A
(
isA
<
Exception
>())
);
),
throws
Exception
);
});
testWithoutContext
(
'processSkSLBundle throws exception if the bundle is not '
...
...
@@ -154,7 +153,7 @@ flutter:
fileSystem:
fileSystem
,
logger:
logger
,
engineVersion:
null
,
),
throws
A
(
isA
<
Exception
>())
);
),
throws
Exception
);
expect
(
logger
.
errorText
,
contains
(
'was not a JSON object'
));
});
...
...
@@ -171,7 +170,7 @@ flutter:
fileSystem:
fileSystem
,
logger:
logger
,
engineVersion:
null
,
),
throws
A
(
isA
<
Exception
>())
);
),
throws
Exception
);
expect
(
logger
.
errorText
,
contains
(
'was not a JSON object'
));
});
...
...
@@ -192,7 +191,7 @@ flutter:
fileSystem:
fileSystem
,
logger:
logger
,
engineVersion:
'2'
,
),
throws
A
(
isA
<
Exception
>())
);
),
throws
Exception
);
expect
(
logger
.
errorText
,
contains
(
'Expected Flutter 1, but found 2'
));
});
...
...
packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart
View file @
7d46d436
...
...
@@ -104,8 +104,7 @@ void main() {
],
exitCode:
1
),
]);
await
expectLater
(()
=>
const
KernelSnapshot
().
build
(
androidEnvironment
),
throwsA
(
isA
<
Exception
>()));
await
expectLater
(()
=>
const
KernelSnapshot
().
build
(
androidEnvironment
),
throwsException
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
...
...
@@ -434,8 +433,7 @@ void main() {
});
testUsingContext
(
'AotAssemblyProfile throws error if built for non-iOS platform'
,
()
async
{
expect
(
const
AotAssemblyProfile
().
build
(
androidEnvironment
),
throwsA
(
isA
<
Exception
>()));
expect
(
const
AotAssemblyProfile
().
build
(
androidEnvironment
),
throwsException
);
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
macPlatform
,
FileSystem:
()
=>
fileSystem
,
...
...
packages/flutter_tools/test/general.shard/build_system/targets/desktop_test.dart
View file @
7d46d436
...
...
@@ -64,7 +64,7 @@ void main() {
'a.txt'
,
],
clientSourcePaths:
<
String
>[
'foo'
],
),
throws
A
(
isA
<
Exception
>())
);
),
throws
Exception
);
});
testWithoutContext
(
'unpackDesktopArtifacts throws when attempting to copy missing directory'
,
()
async
{
...
...
@@ -79,7 +79,7 @@ void main() {
'a.txt'
,
],
clientSourcePaths:
<
String
>[
'foo'
],
),
throws
A
(
isA
<
Exception
>())
);
),
throws
Exception
);
});
testWithoutContext
(
'unpackDesktopArtifacts does not require a client source path'
,
()
async
{
...
...
packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart
View file @
7d46d436
...
...
@@ -225,7 +225,7 @@ void main() {
fileSystem:
fileSystem
,
);
expect
(
const
AotAssemblyRelease
().
build
(
environment
),
throwsA
(
is
A
<
Exception
>()
expect
(
const
AotAssemblyRelease
().
build
(
environment
),
throwsA
(
is
Exception
.
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
'description'
,
...
...
@@ -254,13 +254,11 @@ void main() {
environment
.
defines
[
kBuildMode
]
=
'release'
;
environment
.
defines
[
kIosArchs
]
=
'x86_64'
;
expect
(
const
AotAssemblyRelease
().
build
(
environment
),
throwsA
(
isA
<
Exception
>()
.
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
expect
(
const
AotAssemblyRelease
().
build
(
environment
),
throwsA
(
isException
.
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
'description'
,
contains
(
'required define SdkRoot but it was not provided'
),
)
));
)));
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
...
...
@@ -371,7 +369,7 @@ void main() {
processManager
.
addCommand
(
copyPhysicalFrameworkCommand
);
await
expectLater
(
const
DebugUnpackIOS
().
build
(
environment
),
throwsA
(
is
A
<
Exception
>()
.
having
(
throwsA
(
is
Exception
.
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
'description'
,
contains
(
'Flutter.framework/Flutter does not exist, cannot thin'
),
...
...
@@ -412,12 +410,13 @@ void main() {
]);
await
expectLater
(
const
DebugUnpackIOS
().
build
(
environment
),
throwsA
(
isA
<
Exception
>().
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
'description'
,
contains
(
'does not contain arm64 armv7. Running lipo -info:
\n
Architectures in the fat file:'
),
)));
const
DebugUnpackIOS
().
build
(
environment
),
throwsA
(
isException
.
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
'description'
,
contains
(
'does not contain arm64 armv7. Running lipo -info:
\n
Architectures in the fat file:'
),
)),
);
});
testWithoutContext
(
'fails when lipo extract fails'
,
()
async
{
...
...
@@ -466,11 +465,12 @@ void main() {
await
expectLater
(
const
DebugUnpackIOS
().
build
(
environment
),
throwsA
(
is
A
<
Exception
>()
.
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
throwsA
(
is
Exception
.
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
'description'
,
contains
(
'Failed to extract arm64 armv7 for output/Flutter.framework/Flutter.
\n
lipo error
\n
Running lipo -info:
\n
Architectures in the fat file:'
),
)));
)),
);
});
testWithoutContext
(
'skips thin framework'
,
()
async
{
...
...
@@ -581,12 +581,13 @@ void main() {
]);
await
expectLater
(
const
DebugUnpackIOS
().
build
(
environment
),
throwsA
(
isA
<
Exception
>().
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
'description'
,
contains
(
'Failed to strip bitcode for output/Flutter.framework/Flutter.
\n
bitcode_strip error'
),
)));
const
DebugUnpackIOS
().
build
(
environment
),
throwsA
(
isException
.
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
'description'
,
contains
(
'Failed to strip bitcode for output/Flutter.framework/Flutter.
\n
bitcode_strip error'
),
)),
);
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
});
...
...
@@ -653,12 +654,13 @@ void main() {
]);
await
expectLater
(
const
DebugUnpackIOS
().
build
(
environment
),
throwsA
(
isA
<
Exception
>().
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
'description'
,
contains
(
'Failed to codesign output/Flutter.framework/Flutter with identity ABC123.
\n
codesign error'
),
)));
const
DebugUnpackIOS
().
build
(
environment
),
throwsA
(
isException
.
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
'description'
,
contains
(
'Failed to codesign output/Flutter.framework/Flutter with identity ABC123.
\n
codesign error'
),
)),
);
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
});
...
...
packages/flutter_tools/test/general.shard/build_system/targets/localizations_test.dart
View file @
7d46d436
...
...
@@ -96,7 +96,7 @@ use-deferred-loading: string
file:
configFile
,
logger:
BufferLogger
.
test
(),
),
throws
A
(
isA
<
Exception
>())
,
throws
Exception
,
);
});
}
packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart
View file @
7d46d436
...
...
@@ -105,12 +105,13 @@ void main() {
testUsingContext
(
'thinning fails when framework missing'
,
()
async
{
processManager
.
addCommand
(
copyFrameworkCommand
);
await
expectLater
(
const
DebugUnpackMacOS
().
build
(
environment
),
throwsA
(
isA
<
Exception
>().
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
'description'
,
contains
(
'FlutterMacOS.framework/FlutterMacOS does not exist, cannot thin'
),
)));
const
DebugUnpackMacOS
().
build
(
environment
),
throwsA
(
isException
.
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
'description'
,
contains
(
'FlutterMacOS.framework/FlutterMacOS does not exist, cannot thin'
),
)),
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
...
...
@@ -132,12 +133,13 @@ void main() {
]);
await
expectLater
(
const
DebugUnpackMacOS
().
build
(
environment
),
throwsA
(
isA
<
Exception
>().
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
'description'
,
contains
(
'does not contain arm64 x86_64. Running lipo -info:
\n
Architectures in the fat file:'
),
)));
const
DebugUnpackMacOS
().
build
(
environment
),
throwsA
(
isException
.
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
'description'
,
contains
(
'does not contain arm64 x86_64. Running lipo -info:
\n
Architectures in the fat file:'
),
)),
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
...
...
packages/flutter_tools/test/general.shard/cache_test.dart
View file @
7d46d436
...
...
@@ -290,7 +290,7 @@ void main() {
);
await
expectLater
(
()
=>
cache
.
updateAll
(<
DevelopmentArtifact
>{
null
}),
throws
A
(
isA
<
Exception
>())
,
throws
Exception
,
);
verify
(
artifact1
.
update
(
any
,
any
,
any
,
any
));
// Don't continue when retrieval fails.
...
...
packages/flutter_tools/test/general.shard/device_test.dart
View file @
7d46d436
...
...
@@ -7,7 +7,6 @@
import
'dart:async'
;
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/logger.dart'
;
import
'package:flutter_tools/src/base/terminal.dart'
;
...
...
@@ -336,7 +335,7 @@ void main() {
);
await
expectLater
(
()
async
=>
deviceManager
.
findTargetDevices
(
FakeFlutterProject
()),
throws
A
(
isA
<
ToolExit
>())
throws
ToolExit
(),
);
});
...
...
packages/flutter_tools/test/general.shard/ios/devices_test.dart
View file @
7d46d436
...
...
@@ -516,8 +516,8 @@ void main() {
);
when
(
mockXcdevice
.
isInstalled
).
thenReturn
(
false
);
expect
(
()
async
{
await
iosDevices
.
pollingGetDevices
();
},
throwsA
(
isA
<
UnsupportedError
>())
,
()
async
{
await
iosDevices
.
pollingGetDevices
();
},
throwsUnsupportedError
,
);
});
}
...
...
packages/flutter_tools/test/general.shard/mdns_discovery_test.dart
View file @
7d46d436
...
...
@@ -214,7 +214,7 @@ void main() {
);
expect
(
()
async
=>
portDiscovery
.
query
(),
throws
A
(
isA
<
Exception
>())
,
throws
Exception
,
);
});
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_cold_test.dart
View file @
7d46d436
...
...
@@ -114,7 +114,7 @@ void main() {
usage:
TestUsage
(),
);
expect
(()
async
=>
residentWebRunner
.
run
(),
throws
A
(
isA
<
Exception
>())
);
expect
(()
async
=>
residentWebRunner
.
run
(),
throws
Exception
);
expect
(
await
residentWebRunner
.
waitForAppToFinish
(),
1
);
},
overrides:
<
Type
,
Generator
>{
BuildSystem:
()
=>
TestBuildSystem
.
error
(
Exception
(
'foo'
)),
...
...
packages/flutter_tools/test/general.shard/runner/flutter_command_test.dart
View file @
7d46d436
...
...
@@ -212,7 +212,7 @@ void main() {
);
await
expectLater
(
()
=>
flutterCommand
.
run
(),
throws
A
(
isA
<
ToolExit
>()
),
throws
ToolExit
(
),
);
expect
(
usage
.
events
,
<
TestUsageEvent
>[
const
TestUsageEvent
(
...
...
@@ -436,7 +436,7 @@ void main() {
await
expectLater
(
()
=>
flutterCommand
.
run
(),
throws
A
(
isA
<
ToolExit
>()
),
throws
ToolExit
(
),
);
expect
(
usage
.
timings
,
contains
(
const
TestTimingEvent
(
...
...
packages/flutter_tools/test/general.shard/testbed_test.dart
View file @
7d46d436
...
...
@@ -96,7 +96,7 @@ void main() {
ProcessUtils:
()
=>
null
,
});
expect
(()
=>
testbed
.
run
(()
{}),
throws
A
(
isA
<
StateError
>())
);
expect
(()
=>
testbed
.
run
(()
{}),
throws
StateError
);
});
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment