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
3e5f620a
Unverified
Commit
3e5f620a
authored
Apr 08, 2021
by
Jenn Magder
Committed by
GitHub
Apr 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert some general.shard base tests to null safety (#79985)
parent
71e99d29
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
87 additions
and
113 deletions
+87
-113
common.dart
packages/flutter_tools/lib/src/base/common.dart
+1
-1
context.dart
packages/flutter_tools/lib/src/base/context.dart
+1
-1
logs_test.dart
...flutter_tools/test/commands.shard/hermetic/logs_test.dart
+0
-0
async_guard_test.dart
...utter_tools/test/general.shard/base/async_guard_test.dart
+4
-5
common_test.dart
...es/flutter_tools/test/general.shard/base/common_test.dart
+0
-2
deferred_component_test.dart
...ools/test/general.shard/base/deferred_component_test.dart
+22
-25
file_system_test.dart
...utter_tools/test/general.shard/base/file_system_test.dart
+5
-8
fingerprint_test.dart
...utter_tools/test/general.shard/base/fingerprint_test.dart
+7
-8
io_test.dart
packages/flutter_tools/test/general.shard/base/io_test.dart
+11
-13
net_test.dart
packages/flutter_tools/test/general.shard/base/net_test.dart
+17
-19
os_test.dart
packages/flutter_tools/test/general.shard/base/os_test.dart
+1
-1
os_utils_test.dart
.../flutter_tools/test/general.shard/base/os_utils_test.dart
+2
-4
platform_test.dart
.../flutter_tools/test/general.shard/base/platform_test.dart
+2
-4
signals_test.dart
...s/flutter_tools/test/general.shard/base/signals_test.dart
+8
-10
terminal_test.dart
.../flutter_tools/test/general.shard/base/terminal_test.dart
+6
-8
user_messages_test.dart
...ter_tools/test/general.shard/base/user_messages_test.dart
+0
-2
hash_test.dart
...tter_tools/test/general.shard/build_system/hash_test.dart
+0
-2
No files found.
packages/flutter_tools/lib/src/base/common.dart
View file @
3e5f620a
...
...
@@ -33,4 +33,4 @@ class ToolExit implements Exception {
/// the flutter_tools package. However, there are times where one or more
/// futures are intentionally not awaited. This function may be used to ignore a
/// particular future. It silences the unawaited_futures lint.
void
unawaited
(
Future
<
void
>
future
)
{
}
void
unawaited
(
Future
<
void
>
?
future
)
{
}
packages/flutter_tools/lib/src/base/context.dart
View file @
3e5f620a
...
...
@@ -118,7 +118,7 @@ class AppContext {
if
(
value
==
null
&&
_parent
!=
null
)
{
value
=
_parent
!.
get
<
T
>();
}
return
_unboxNull
(
value
??
_generateIfNecessary
(
T
,
_fallbacks
))
as
T
;
return
_unboxNull
(
value
??
_generateIfNecessary
(
T
,
_fallbacks
))
as
T
?
;
}
/// Runs [body] in a child context and returns the value returned by [body].
...
...
packages/flutter_tools/test/
general.shard/base
/logs_test.dart
→
packages/flutter_tools/test/
commands.shard/hermetic
/logs_test.dart
View file @
3e5f620a
File moved
packages/flutter_tools/test/general.shard/base/async_guard_test.dart
View file @
3e5f620a
...
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:async'
;
...
...
@@ -32,7 +31,7 @@ Future<void> syncAndAsyncError() {
Future
<
void
>
delayedThrow
(
FakeAsync
time
)
{
final
Future
<
void
>
result
=
Future
<
void
>.
delayed
(
const
Duration
(
milliseconds:
10
))
.
then
((
_
)
{
.
then
((
_
)
async
{
throw
'Delayed Doom'
;
});
time
.
elapse
(
const
Duration
(
seconds:
1
));
...
...
@@ -41,10 +40,10 @@ Future<void> delayedThrow(FakeAsync time) {
}
void
main
(
)
{
Completer
<
void
>
caughtInZone
;
late
Completer
<
void
>
caughtInZone
;
bool
caughtByZone
=
false
;
bool
caughtByHandler
=
false
;
Zone
zone
;
late
Zone
zone
;
setUp
(()
{
caughtInZone
=
Completer
<
void
>();
...
...
@@ -270,7 +269,7 @@ void main() {
unawaited
(
runZonedGuarded
(()
async
{
final
Future
<
void
>
f
=
asyncGuard
<
void
>(
()
=>
delayedThrow
(
time
),
onError:
(
Object
e
,
[
StackTrace
s
])
{
onError:
(
Object
e
,
[
StackTrace
?
s
])
{
caughtByOnError
=
true
;
nonNullStackTrace
=
s
!=
null
;
},
...
...
packages/flutter_tools/test/general.shard/base/common_test.dart
View file @
3e5f620a
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter_tools/src/base/common.dart'
;
import
'package:flutter_tools/src/base/context.dart'
;
...
...
packages/flutter_tools/test/general.shard/base/deferred_component_test.dart
View file @
3e5f620a
...
...
@@ -2,19 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/base/deferred_component.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
void
main
(
)
{
group
(
'DeferredComponent basics'
,
()
{
test
(
'constructor sets values'
,
()
{
test
WithoutContext
(
'constructor sets values'
,
()
{
final
DeferredComponent
component
=
DeferredComponent
(
name:
'bestcomponent'
,
libraries:
<
String
>[
'lib1'
,
'lib2'
],
...
...
@@ -25,7 +22,7 @@ void main() {
expect
(
component
.
assets
,
<
Uri
>[
Uri
.
file
(
'asset1'
),
Uri
.
file
(
'asset2'
)]);
});
test
(
'assignLoadingUnits selects the needed loading units and sets assigned'
,
()
{
test
WithoutContext
(
'assignLoadingUnits selects the needed loading units and sets assigned'
,
()
{
final
DeferredComponent
component
=
DeferredComponent
(
name:
'bestcomponent'
,
libraries:
<
String
>[
'lib1'
,
'lib2'
],
...
...
@@ -56,10 +53,10 @@ void main() {
component
.
assignLoadingUnits
(
loadingUnits1
);
expect
(
component
.
assigned
,
true
);
expect
(
component
.
loadingUnits
.
length
,
2
);
expect
(
component
.
loadingUnits
.
contains
(
loadingUnits1
[
0
]),
true
);
expect
(
component
.
loadingUnits
.
contains
(
loadingUnits1
[
1
]),
true
);
expect
(
component
.
loadingUnits
.
contains
(
loadingUnits1
[
2
]),
false
);
expect
(
component
.
loadingUnits
,
hasLength
(
2
)
);
expect
(
component
.
loadingUnits
,
contains
(
loadingUnits1
[
0
])
);
expect
(
component
.
loadingUnits
,
contains
(
loadingUnits1
[
1
])
);
expect
(
component
.
loadingUnits
,
isNot
(
contains
(
loadingUnits1
[
2
]))
);
final
List
<
LoadingUnit
>
loadingUnits2
=
<
LoadingUnit
>[
LoadingUnit
(
...
...
@@ -82,18 +79,18 @@ void main() {
component
.
assignLoadingUnits
(
loadingUnits2
);
expect
(
component
.
assigned
,
true
);
expect
(
component
.
loadingUnits
.
length
,
1
);
expect
(
component
.
loadingUnits
.
contains
(
loadingUnits2
[
0
]),
true
);
expect
(
component
.
loadingUnits
.
contains
(
loadingUnits2
[
1
]),
false
);
expect
(
component
.
loadingUnits
.
contains
(
loadingUnits2
[
2
]),
false
);
expect
(
component
.
loadingUnits
,
hasLength
(
1
)
);
expect
(
component
.
loadingUnits
,
contains
(
loadingUnits2
[
0
])
);
expect
(
component
.
loadingUnits
,
isNot
(
contains
(
loadingUnits2
[
1
]))
);
expect
(
component
.
loadingUnits
,
isNot
(
contains
(
loadingUnits2
[
2
]))
);
component
.
assignLoadingUnits
(<
LoadingUnit
>[]);
expect
(
component
.
assigned
,
true
);
expect
(
component
.
loadingUnits
.
length
,
0
);
expect
(
component
.
loadingUnits
,
hasLength
(
0
)
);
});
test
(
'toString produces correct string for unassigned component'
,
()
{
test
WithoutContext
(
'toString produces correct string for unassigned component'
,
()
{
final
DeferredComponent
component
=
DeferredComponent
(
name:
'bestcomponent'
,
libraries:
<
String
>[
'lib1'
,
'lib2'
],
...
...
@@ -102,7 +99,7 @@ void main() {
expect
(
component
.
toString
(),
'
\n
DeferredComponent: bestcomponent
\n
Libraries:
\n
- lib1
\n
- lib2
\n
Assets:
\n
- asset1
\n
- asset2'
);
});
test
(
'toString produces correct string for assigned component'
,
()
{
test
WithoutContext
(
'toString produces correct string for assigned component'
,
()
{
final
DeferredComponent
component
=
DeferredComponent
(
name:
'bestcomponent'
,
libraries:
<
String
>[
'lib1'
,
'lib2'
],
...
...
@@ -114,7 +111,7 @@ void main() {
});
group
(
'LoadingUnit basics'
,
()
{
test
(
'constructor sets values'
,
()
{
test
WithoutContext
(
'constructor sets values'
,
()
{
final
LoadingUnit
unit
=
LoadingUnit
(
id:
2
,
path:
'path/to/so.so'
,
...
...
@@ -125,7 +122,7 @@ void main() {
expect
(
unit
.
libraries
,
<
String
>[
'lib1'
,
'lib4'
]);
});
test
(
'toString produces correct string'
,
()
{
test
WithoutContext
(
'toString produces correct string'
,
()
{
final
LoadingUnit
unit
=
LoadingUnit
(
id:
2
,
path:
'path/to/so.so'
,
...
...
@@ -134,7 +131,7 @@ void main() {
expect
(
unit
.
toString
(),
'
\n
LoadingUnit 2
\n
Libraries:
\n
- lib1
\n
- lib4'
);
});
test
(
'equalsIgnoringPath works for various input'
,
()
{
test
WithoutContext
(
'equalsIgnoringPath works for various input'
,
()
{
final
LoadingUnit
unit1
=
LoadingUnit
(
id:
2
,
path:
'path/to/so.so'
,
...
...
@@ -172,7 +169,7 @@ void main() {
expect
(
unit5
.
equalsIgnoringPath
(
unit6
),
false
);
});
test
(
'parseLoadingUnitManifest parses single manifest file'
,
()
{
test
WithoutContext
(
'parseLoadingUnitManifest parses single manifest file'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
File
manifest
=
fileSystem
.
file
(
'/manifest.json'
);
manifest
.
createSync
(
recursive:
true
);
...
...
@@ -202,7 +199,7 @@ void main() {
expect
(
loadingUnits
[
1
].
libraries
[
1
],
'lib4'
);
});
test
Using
Context
(
'parseLoadingUnitManifest returns empty when manifest is invalid JSON'
,
()
{
test
Without
Context
(
'parseLoadingUnitManifest returns empty when manifest is invalid JSON'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
File
manifest
=
fileSystem
.
file
(
'/manifest.json'
);
manifest
.
createSync
(
recursive:
true
);
...
...
@@ -225,7 +222,7 @@ void main() {
expect
(
loadingUnits
.
isEmpty
,
true
);
});
test
Using
Context
(
'parseLoadingUnitManifest does not exist'
,
()
{
test
Without
Context
(
'parseLoadingUnitManifest does not exist'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
File
manifest
=
fileSystem
.
file
(
'/manifest.json'
);
if
(
manifest
.
existsSync
())
{
...
...
@@ -236,7 +233,7 @@ void main() {
expect
(
loadingUnits
.
isEmpty
,
true
);
});
test
(
'parseGeneratedLoadingUnits parses all abis if no abis provided'
,
()
{
test
WithoutContext
(
'parseGeneratedLoadingUnits parses all abis if no abis provided'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
File
manifest1
=
fileSystem
.
file
(
'/test-abi1/manifest.json'
);
manifest1
.
createSync
(
recursive:
true
);
...
...
@@ -293,7 +290,7 @@ void main() {
expect
(
loadingUnits
[
3
].
libraries
[
1
],
'lib4'
);
});
test
(
'parseGeneratedLoadingUnits only parses provided abis'
,
()
{
test
WithoutContext
(
'parseGeneratedLoadingUnits only parses provided abis'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
File
manifest1
=
fileSystem
.
file
(
'/test-abi1/manifest.json'
);
manifest1
.
createSync
(
recursive:
true
);
...
...
@@ -340,7 +337,7 @@ void main() {
expect
(
loadingUnits
[
1
].
libraries
[
1
],
'lib4'
);
});
test
(
'parseGeneratedLoadingUnits returns empty when no manifest files exist'
,
()
{
test
WithoutContext
(
'parseGeneratedLoadingUnits returns empty when no manifest files exist'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
List
<
LoadingUnit
>
loadingUnits
=
LoadingUnit
.
parseGeneratedLoadingUnits
(
fileSystem
.
directory
(
'/'
),
BufferLogger
.
test
());
...
...
packages/flutter_tools/test/general.shard/base/file_system_test.dart
View file @
3e5f620a
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:async'
;
import
'dart:io'
as
io
;
...
...
@@ -15,12 +13,11 @@ import 'package:flutter_tools/src/base/signals.dart';
import
'package:test/fake.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
void
main
(
)
{
group
(
'fsUtils'
,
()
{
MemoryFileSystem
fs
;
FileSystemUtils
fsUtils
;
late
MemoryFileSystem
fs
;
late
FileSystemUtils
fsUtils
;
setUp
(()
{
fs
=
MemoryFileSystem
.
test
();
...
...
@@ -129,15 +126,15 @@ void main() {
});
group
(
'LocalFileSystem'
,
()
{
FakeProcessSignal
fakeSignal
;
ProcessSignal
signalUnderTest
;
late
FakeProcessSignal
fakeSignal
;
late
ProcessSignal
signalUnderTest
;
setUp
(()
{
fakeSignal
=
FakeProcessSignal
();
signalUnderTest
=
ProcessSignal
(
fakeSignal
);
});
test
Using
Context
(
'deletes system temp entry on a fatal signal'
,
()
async
{
test
Without
Context
(
'deletes system temp entry on a fatal signal'
,
()
async
{
final
Completer
<
void
>
completer
=
Completer
<
void
>();
final
Signals
signals
=
Signals
.
test
();
final
LocalFileSystem
localFileSystem
=
LocalFileSystem
.
test
(
...
...
packages/flutter_tools/test/general.shard/base/fingerprint_test.dart
View file @
3e5f620a
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:convert'
show
json
;
import
'package:file/memory.dart'
;
...
...
@@ -12,9 +10,10 @@ import 'package:flutter_tools/src/base/logger.dart';
import
'package:flutter_tools/src/base/utils.dart'
;
import
'../../src/common.dart'
;
void
main
(
)
{
group
(
'Fingerprinter'
,
()
{
MemoryFileSystem
fileSystem
;
late
MemoryFileSystem
fileSystem
;
setUp
(()
{
fileSystem
=
MemoryFileSystem
.
test
();
...
...
@@ -85,7 +84,7 @@ void main() {
group
(
'Fingerprint'
,
()
{
group
(
'fromBuildInputs'
,
()
{
MemoryFileSystem
fileSystem
;
late
MemoryFileSystem
fileSystem
;
setUp
(()
{
fileSystem
=
MemoryFileSystem
.
test
();
...
...
@@ -104,8 +103,8 @@ void main() {
fileSystem
.
file
(
'b.dart'
).
writeAsStringSync
(
'This is b'
);
final
Fingerprint
fingerprint
=
Fingerprint
.
fromBuildInputs
(
const
<
String
>[
'a.dart'
,
'b.dart'
],
fileSystem
);
final
Map
<
String
,
dynamic
>
jsonObject
=
castStringKeyedMap
(
json
.
decode
(
fingerprint
.
toJson
()));
expect
(
jsonObject
[
'files'
],
hasLength
(
2
));
final
Map
<
String
,
dynamic
>
?
jsonObject
=
castStringKeyedMap
(
json
.
decode
(
fingerprint
.
toJson
()));
expect
(
jsonObject
!
[
'files'
],
hasLength
(
2
));
expect
(
jsonObject
[
'files'
][
'a.dart'
],
'8a21a15fad560b799f6731d436c1b698'
);
expect
(
jsonObject
[
'files'
][
'b.dart'
],
'6f144e08b58cd0925328610fad7ac07c'
);
});
...
...
@@ -124,9 +123,9 @@ void main() {
},
});
final
Fingerprint
fingerprint
=
Fingerprint
.
fromJson
(
jsonString
);
final
Map
<
String
,
dynamic
>
content
=
castStringKeyedMap
(
json
.
decode
(
fingerprint
.
toJson
()));
final
Map
<
String
,
dynamic
>
?
content
=
castStringKeyedMap
(
json
.
decode
(
fingerprint
.
toJson
()));
expect
(
content
,
hasLength
(
1
));
expect
(
content
[
'files'
],
hasLength
(
2
));
expect
(
content
!
[
'files'
],
hasLength
(
2
));
expect
(
content
[
'files'
][
'a.dart'
],
'8a21a15fad560b799f6731d436c1b698'
);
expect
(
content
[
'files'
][
'b.dart'
],
'6f144e08b58cd0925328610fad7ac07c'
);
});
...
...
packages/flutter_tools/test/general.shard/base/io_test.dart
View file @
3e5f620a
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:async'
;
import
'dart:io'
as
io
;
...
...
@@ -13,11 +11,10 @@ import 'package:flutter_tools/src/base/platform.dart';
import
'package:test/fake.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/io.dart'
;
void
main
(
)
{
test
(
'IOOverrides can inject a memory file system'
,
()
async
{
test
WithoutContext
(
'IOOverrides can inject a memory file system'
,
()
async
{
final
MemoryFileSystem
memoryFileSystem
=
MemoryFileSystem
.
test
();
final
FlutterIOOverrides
flutterIOOverrides
=
FlutterIOOverrides
(
fileSystem:
memoryFileSystem
);
await
io
.
IOOverrides
.
runWithIOOverrides
(()
async
{
...
...
@@ -57,7 +54,8 @@ void main() {
expect
(
memoryFileSystem
.
link
(
'ggg'
).
resolveSymbolicLinksSync
(),
linkB
.
resolveSymbolicLinksSync
());
},
flutterIOOverrides
);
});
testUsingContext
(
'ProcessSignal signals are properly delegated'
,
()
async
{
testWithoutContext
(
'ProcessSignal signals are properly delegated'
,
()
async
{
final
FakeProcessSignal
signal
=
FakeProcessSignal
();
final
ProcessSignal
signalUnderTest
=
ProcessSignal
(
signal
);
...
...
@@ -66,15 +64,15 @@ void main() {
expect
(
signalUnderTest
,
await
signalUnderTest
.
watch
().
first
);
});
test
Using
Context
(
'ProcessSignal toString() works'
,
()
async
{
test
Without
Context
(
'ProcessSignal toString() works'
,
()
async
{
expect
(
io
.
ProcessSignal
.
sigint
.
toString
(),
ProcessSignal
.
sigint
.
toString
());
});
test
(
'exit throws a StateError if called without being overriden'
,
()
{
test
WithoutContext
(
'exit throws a StateError if called without being overriden'
,
()
{
expect
(()
=>
exit
(
0
),
throwsAssertionError
);
});
test
(
'exit does not throw a StateError if overriden'
,
()
{
test
WithoutContext
(
'exit does not throw a StateError if overriden'
,
()
{
try
{
setExitFunctionForTests
((
int
value
)
{});
...
...
@@ -84,16 +82,16 @@ void main() {
}
});
test
(
'test_api defines the Declarer in a known place'
,
()
{
test
WithoutContext
(
'test_api defines the Declarer in a known place'
,
()
{
expect
(
Zone
.
current
[
#test
.
declarer
],
isNotNull
);
});
test
(
'listNetworkInterfaces() uses overrides'
,
()
async
{
test
WithoutContext
(
'listNetworkInterfaces() uses overrides'
,
()
async
{
setNetworkInterfaceLister
(
({
bool
includeLoopback
,
bool
includeLinkLocal
,
InternetAddressType
type
,
bool
?
includeLoopback
,
bool
?
includeLinkLocal
,
InternetAddressType
?
type
,
})
async
=>
<
NetworkInterface
>[],
);
...
...
packages/flutter_tools/test/general.shard/base/net_test.dart
View file @
3e5f620a
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:convert'
;
import
'package:file/file.dart'
;
...
...
@@ -20,7 +18,7 @@ import '../../src/common.dart';
import
'../../src/fake_http_client.dart'
;
void
main
(
)
{
BufferLogger
testLogger
;
late
BufferLogger
testLogger
;
setUp
(()
{
testLogger
=
BufferLogger
.
test
();
...
...
@@ -36,7 +34,7 @@ void main() {
group
(
'successful fetch'
,
()
{
const
String
responseString
=
'response string'
;
List
<
int
>
responseData
;
late
List
<
int
>
responseData
;
setUp
(()
{
responseData
=
utf8
.
encode
(
responseString
);
...
...
@@ -51,7 +49,7 @@ void main() {
])
);
final
List
<
int
>
data
=
await
net
.
fetchUrl
(
Uri
.
parse
(
'http://example.invalid/'
));
final
List
<
int
>
?
data
=
await
net
.
fetchUrl
(
Uri
.
parse
(
'http://example.invalid/'
));
expect
(
data
,
equals
(
responseData
));
});
...
...
@@ -65,7 +63,7 @@ void main() {
);
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
File
destFile
=
fileSystem
.
file
(
'dest_file'
)..
createSync
();
final
List
<
int
>
data
=
await
net
.
fetchUrl
(
final
List
<
int
>
?
data
=
await
net
.
fetchUrl
(
Uri
.
parse
(
'http://example.invalid/'
),
destFile:
destFile
,
);
...
...
@@ -127,9 +125,9 @@ void main() {
FakeRequest
(
invalid
,
responseError:
const
io
.
SocketException
(
''
)),
])
);
String
error
;
String
?
error
;
FakeAsync
().
run
((
FakeAsync
time
)
{
net
.
fetchUrl
(
invalid
).
then
((
List
<
int
>
value
)
{
net
.
fetchUrl
(
invalid
).
then
((
List
<
int
>
?
value
)
async
{
error
=
'test completed unexpectedly'
;
},
onError:
(
dynamic
exception
)
{
error
=
'test failed unexpectedly:
$exception
'
;
...
...
@@ -158,9 +156,9 @@ void main() {
FakeRequest
(
invalid
,
responseError:
const
io
.
HandshakeException
(
''
)),
])
);
String
error
;
String
?
error
;
FakeAsync
().
run
((
FakeAsync
time
)
{
net
.
fetchUrl
(
invalid
).
then
((
List
<
int
>
value
)
{
net
.
fetchUrl
(
invalid
).
then
((
List
<
int
>
?
value
)
async
{
error
=
'test completed unexpectedly'
;
},
onError:
(
dynamic
exception
)
{
error
=
'test failed:
$exception
'
;
...
...
@@ -188,9 +186,9 @@ void main() {
},
),
);
String
error
;
String
?
error
;
FakeAsync
().
run
((
FakeAsync
time
)
{
net
.
fetchUrl
(
Uri
.
parse
(
'example.invalid/'
)).
then
((
List
<
int
>
value
)
{
net
.
fetchUrl
(
Uri
.
parse
(
'example.invalid/'
)).
then
((
List
<
int
>
?
value
)
async
{
error
=
'test completed unexpectedly'
;
},
onError:
(
dynamic
exception
)
{
error
=
'test failed:
$exception
'
;
...
...
@@ -214,9 +212,9 @@ void main() {
FakeRequest
(
invalid
,
responseError:
const
io
.
HttpException
(
''
)),
])
);
String
error
;
String
?
error
;
FakeAsync
().
run
((
FakeAsync
time
)
{
net
.
fetchUrl
(
invalid
).
then
((
List
<
int
>
value
)
{
net
.
fetchUrl
(
invalid
).
then
((
List
<
int
>
?
value
)
async
{
error
=
'test completed unexpectedly'
;
},
onError:
(
dynamic
exception
)
{
error
=
'test failed unexpectedly:
$exception
'
;
...
...
@@ -245,9 +243,9 @@ void main() {
FakeRequest
(
invalid
,
responseError:
const
io
.
HttpException
(
''
)),
])
);
String
error
;
String
?
error
;
FakeAsync
().
run
((
FakeAsync
time
)
{
net
.
fetchUrl
(
invalid
).
then
((
List
<
int
>
value
)
{
net
.
fetchUrl
(
invalid
).
then
((
List
<
int
>
?
value
)
async
{
error
=
'test completed unexpectedly'
;
},
onError:
(
dynamic
exception
)
{
error
=
'test failed unexpectedly:
$exception
'
;
...
...
@@ -281,10 +279,10 @@ void main() {
)),
])
);
String
error
;
List
<
int
>
actualResult
;
String
?
error
;
List
<
int
>
?
actualResult
;
FakeAsync
().
run
((
FakeAsync
time
)
{
net
.
fetchUrl
(
invalid
,
maxAttempts:
3
).
then
((
List
<
int
>
value
)
{
net
.
fetchUrl
(
invalid
,
maxAttempts:
3
).
then
((
List
<
int
>
?
value
)
async
{
actualResult
=
value
;
},
onError:
(
dynamic
exception
)
{
error
=
'test failed unexpectedly:
$exception
'
;
...
...
packages/flutter_tools/test/general.shard/base/os_test.dart
View file @
3e5f620a
...
...
@@ -13,7 +13,7 @@ import 'package:flutter_tools/src/base/os.dart';
import
'package:flutter_tools/src/base/platform.dart'
;
import
'../../src/common.dart'
;
import
'../../src/
context
.dart'
;
import
'../../src/
fake_process_manager
.dart'
;
const
String
kExecutable
=
'foo'
;
const
String
kPath1
=
'/bar/bin/
$kExecutable
'
;
...
...
packages/flutter_tools/test/general.shard/base/os_utils_test.dart
View file @
3e5f620a
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/os.dart'
;
...
...
@@ -15,8 +13,8 @@ import '../../src/common.dart';
void
main
(
)
{
group
(
'OperatingSystemUtils'
,
()
{
Directory
tempDir
;
FileSystem
fileSystem
;
late
Directory
tempDir
;
late
FileSystem
fileSystem
;
setUp
(()
{
fileSystem
=
LocalFileSystem
.
test
(
signals:
Signals
.
test
());
...
...
packages/flutter_tools/test/general.shard/base/platform_test.dart
View file @
3e5f620a
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter_tools/src/base/platform.dart'
;
import
'../../src/common.dart'
;
...
...
@@ -26,8 +24,8 @@ void _expectPlatformsEqual(Platform actual, Platform expected) {
void
main
(
)
{
group
(
'FakePlatform.fromPlatform'
,
()
{
FakePlatform
fake
;
LocalPlatform
local
;
late
FakePlatform
fake
;
late
LocalPlatform
local
;
setUp
(()
{
local
=
const
LocalPlatform
();
...
...
packages/flutter_tools/test/general.shard/base/signals_test.dart
View file @
3e5f620a
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:async'
;
import
'dart:io'
as
io
;
...
...
@@ -15,9 +13,9 @@ import '../../src/common.dart';
void
main
(
)
{
group
(
'Signals'
,
()
{
Signals
signals
;
FakeProcessSignal
fakeSignal
;
ProcessSignal
signalUnderTest
;
late
Signals
signals
;
late
FakeProcessSignal
fakeSignal
;
late
ProcessSignal
signalUnderTest
;
setUp
(()
{
signals
=
Signals
.
test
();
...
...
@@ -58,7 +56,7 @@ void main() {
testWithoutContext
(
'signal handlers do not cause concurrent modification errors when removing handlers in a signal callback'
,
()
async
{
final
Completer
<
void
>
completer
=
Completer
<
void
>();
Object
token
;
late
Object
token
;
Future
<
void
>
handle
(
ProcessSignal
s
)
async
{
expect
(
s
,
signalUnderTest
);
expect
(
await
signals
.
removeHandler
(
signalUnderTest
,
token
),
true
);
...
...
@@ -73,7 +71,7 @@ void main() {
testWithoutContext
(
'signal handler error goes on error stream'
,
()
async
{
final
Exception
exn
=
Exception
(
'Error'
);
signals
.
addHandler
(
signalUnderTest
,
(
ProcessSignal
s
)
{
signals
.
addHandler
(
signalUnderTest
,
(
ProcessSignal
s
)
async
{
throw
exn
;
});
...
...
@@ -95,7 +93,7 @@ void main() {
testWithoutContext
(
'removed signal handler does not run'
,
()
async
{
final
Object
token
=
signals
.
addHandler
(
signalUnderTest
,
(
ProcessSignal
s
)
{
(
ProcessSignal
s
)
async
{
fail
(
'Signal handler should have been removed.'
);
},
);
...
...
@@ -124,7 +122,7 @@ void main() {
final
Object
token
=
signals
.
addHandler
(
signalUnderTest
,
(
ProcessSignal
s
)
{
(
ProcessSignal
s
)
async
{
fail
(
'Signal handler should have been removed.'
);
},
);
...
...
@@ -153,7 +151,7 @@ void main() {
completer
.
complete
();
});
signals
.
addHandler
(
otherSignal
,
(
ProcessSignal
s
)
{
signals
.
addHandler
(
otherSignal
,
(
ProcessSignal
s
)
async
{
fail
(
'Wrong signal!.'
);
});
...
...
packages/flutter_tools/test/general.shard/base/terminal_test.dart
View file @
3e5f620a
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
...
...
@@ -37,7 +35,7 @@ void main() {
});
group
(
'ANSI coloring and bold'
,
()
{
AnsiTerminal
terminal
;
late
AnsiTerminal
terminal
;
setUp
(()
{
terminal
=
AnsiTerminal
(
...
...
@@ -108,7 +106,7 @@ void main() {
});
group
(
'character input prompt'
,
()
{
AnsiTerminal
terminalUnderTest
;
late
AnsiTerminal
terminalUnderTest
;
setUp
(()
{
terminalUnderTest
=
TestTerminal
(
stdio:
FakeStdio
());
...
...
@@ -118,7 +116,7 @@ void main() {
expect
(
terminalUnderTest
.
promptForCharInput
(
<
String
>[
'a'
,
'b'
,
'c'
],
prompt:
'Please choose something'
,
logger:
null
,
logger:
BufferLogger
.
test
()
,
),
throwsStateError
);
});
...
...
@@ -183,13 +181,13 @@ void main() {
});
}
Stream
<
String
>
mockStdInStream
;
late
Stream
<
String
>
mockStdInStream
;
class
TestTerminal
extends
AnsiTerminal
{
TestTerminal
({
Stdio
stdio
,
Stdio
?
stdio
,
Platform
platform
=
const
LocalPlatform
(),
})
:
super
(
stdio:
stdio
,
platform:
platform
);
})
:
super
(
stdio:
stdio
??
Stdio
()
,
platform:
platform
);
@override
Stream
<
String
>
get
keystrokes
{
...
...
packages/flutter_tools/test/general.shard/base/user_messages_test.dart
View file @
3e5f620a
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/base/user_messages.dart'
;
...
...
packages/flutter_tools/test/general.shard/build_system/hash_test.dart
View file @
3e5f620a
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:convert'
;
import
'dart:typed_data'
;
...
...
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