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
628ae57e
Unverified
Commit
628ae57e
authored
Mar 15, 2021
by
Jenn Magder
Committed by
GitHub
Mar 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove mocks from compile_expression_test (#78092)
parent
67aaaba4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
20 deletions
+23
-20
icon_tree_shaker_test.dart
...ral.shard/build_system/targets/icon_tree_shaker_test.dart
+3
-3
compile_expression_test.dart
...ter_tools/test/general.shard/compile_expression_test.dart
+7
-12
golden_comparator_process_test.dart
...est/general.shard/web/golden_comparator_process_test.dart
+3
-5
fakes.dart
packages/flutter_tools/test/src/fakes.dart
+10
-0
No files found.
packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart
View file @
628ae57e
...
...
@@ -71,7 +71,7 @@ void main() {
@required
CompleterIOSink
stdinSink
,
})
{
assert
(
stdinSink
!=
null
);
stdinSink
.
writes
.
clear
();
stdinSink
.
clear
();
when
(
fontSubsetProcess
.
exitCode
).
thenAnswer
((
_
)
async
=>
exitCode
);
when
(
fontSubsetProcess
.
stdout
).
thenAnswer
((
_
)
=>
Stream
<
List
<
int
>>.
fromIterable
(<
List
<
int
>>[
utf8
.
encode
(
stdout
)]));
when
(
fontSubsetProcess
.
stderr
).
thenAnswer
((
_
)
=>
Stream
<
List
<
int
>>.
fromIterable
(<
List
<
int
>>[
utf8
.
encode
(
stderr
)]));
...
...
@@ -257,7 +257,7 @@ void main() {
outputPath:
outputPath
,
relativePath:
relativePath
,
);
expect
(
stdinSink
.
writes
,
<
List
<
int
>>[
utf8
.
encode
(
'59470
\n
'
)]
);
expect
(
stdinSink
.
getAndClear
(),
'59470
\n
'
);
_resetFontSubsetInvocation
(
stdinSink:
stdinSink
);
expect
(
subsetted
,
true
);
...
...
@@ -267,7 +267,7 @@ void main() {
relativePath:
relativePath
,
);
expect
(
subsetted
,
true
);
expect
(
stdinSink
.
writes
,
<
List
<
int
>>[
utf8
.
encode
(
'59470
\n
'
)]
);
expect
(
stdinSink
.
getAndClear
(),
'59470
\n
'
);
verify
(
mockProcessManager
.
run
(
_getConstFinderArgs
(
appDill
.
path
))).
called
(
1
);
verify
(
mockProcessManager
.
start
(
fontSubsetArgs
)).
called
(
2
);
...
...
packages/flutter_tools/test/general.shard/compile_expression_test.dart
View file @
628ae57e
...
...
@@ -21,14 +21,13 @@ import 'package:process/process.dart';
import
'../src/common.dart'
;
import
'../src/context.dart'
;
import
'../src/
mock
s.dart'
;
import
'../src/
fake
s.dart'
;
void
main
(
)
{
ProcessManager
mockProcessManager
;
ResidentCompiler
generator
;
MockProcess
mockFrontendServer
;
MockStdIn
mockFrontendServerStdIn
;
MockStream
mockFrontendServerStdErr
;
MemoryIOSink
frontendServerStdIn
;
StreamController
<
String
>
stdErrStreamController
;
BufferLogger
testLogger
;
MemoryFileSystem
fileSystem
;
...
...
@@ -37,8 +36,7 @@ void main() {
testLogger
=
BufferLogger
.
test
();
mockProcessManager
=
MockProcessManager
();
mockFrontendServer
=
MockProcess
();
mockFrontendServerStdIn
=
MockStdIn
();
mockFrontendServerStdErr
=
MockStream
();
frontendServerStdIn
=
MemoryIOSink
();
fileSystem
=
MemoryFileSystem
.
test
();
generator
=
ResidentCompiler
(
'sdkroot'
,
...
...
@@ -50,15 +48,13 @@ void main() {
fileSystem:
fileSystem
,
);
when
(
mockFrontendServer
.
stdin
).
thenReturn
(
mockFrontendServerStdIn
);
stdErrStreamController
=
StreamController
<
String
>();
when
(
mockFrontendServer
.
stdin
).
thenReturn
(
frontendServerStdIn
);
when
(
mockFrontendServer
.
stderr
)
.
thenAnswer
((
Invocation
invocation
)
=>
mockFrontendServerStdErr
);
.
thenAnswer
((
Invocation
invocation
)
=>
stdErrStreamController
.
stream
.
transform
(
utf8
.
encoder
)
);
when
(
mockFrontendServer
.
exitCode
).
thenAnswer
((
Invocation
invocation
)
{
return
Completer
<
int
>().
future
;
});
stdErrStreamController
=
StreamController
<
String
>();
when
(
mockFrontendServerStdErr
.
transform
<
String
>(
any
))
.
thenAnswer
((
Invocation
invocation
)
=>
stdErrStreamController
.
stream
);
when
(
mockProcessManager
.
canRun
(
any
)).
thenReturn
(
true
);
when
(
mockProcessManager
.
start
(
any
)).
thenAnswer
(
...
...
@@ -100,9 +96,8 @@ void main() {
outputPath:
'/build/'
,
packageConfig:
PackageConfig
.
empty
,
).
then
((
CompilerOutput
output
)
{
expect
(
mockF
rontendServerStdIn
.
getAndClear
(),
expect
(
f
rontendServerStdIn
.
getAndClear
(),
'compile file:///path/to/main.dart
\n
'
);
verifyNoMoreInteractions
(
mockFrontendServerStdIn
);
expect
(
testLogger
.
errorText
,
equals
(
'line1
\n
line2
\n
'
));
expect
(
output
.
outputFilename
,
equals
(
'/path/to/main.dart.dill'
));
...
...
packages/flutter_tools/test/general.shard/web/golden_comparator_process_test.dart
View file @
628ae57e
...
...
@@ -48,7 +48,7 @@ void main() {
process
.
sendCommand
(
imageFile
,
goldenKey
,
false
);
final
Map
<
String
,
dynamic
>
response
=
await
process
.
getResponse
();
final
String
stringToStdin
=
stringFromMemoryIOSink
(
ioSink
);
final
String
stringToStdin
=
ioSink
.
getAndClear
(
);
expect
(
response
,
expectedResponse
);
expect
(
stringToStdin
,
'{"imageFile":"test_image_file","key":"file://golden_key/","update":false}
\n
'
);
...
...
@@ -75,7 +75,7 @@ void main() {
process
.
sendCommand
(
imageFile2
,
goldenKey2
,
true
);
final
Map
<
String
,
dynamic
>
response2
=
await
process
.
getResponse
();
final
String
stringToStdin
=
stringFromMemoryIOSink
(
ioSink
);
final
String
stringToStdin
=
ioSink
.
getAndClear
(
);
expect
(
response1
,
expectedResponse1
);
expect
(
response2
,
expectedResponse2
);
...
...
@@ -101,7 +101,7 @@ Other JSON data after the initial data
process
.
sendCommand
(
imageFile
,
goldenKey
,
false
);
final
Map
<
String
,
dynamic
>
response
=
await
process
.
getResponse
();
final
String
stringToStdin
=
stringFromMemoryIOSink
(
ioSink
);
final
String
stringToStdin
=
ioSink
.
getAndClear
(
);
expect
(
response
,
expectedResponse
);
expect
(
stringToStdin
,
'{"imageFile":"test_image_file","key":"file://golden_key/","update":false}
\n
'
);
...
...
@@ -112,5 +112,3 @@ Other JSON data after the initial data
Stream
<
List
<
int
>>
stdoutFromString
(
String
string
)
=>
Stream
<
List
<
int
>>.
fromIterable
(<
List
<
int
>>[
utf8
.
encode
(
string
),
]);
String
stringFromMemoryIOSink
(
MemoryIOSink
ioSink
)
=>
utf8
.
decode
(
ioSink
.
writes
.
expand
((
List
<
int
>
l
)
=>
l
).
toList
());
packages/flutter_tools/test/src/fakes.dart
View file @
628ae57e
...
...
@@ -252,6 +252,16 @@ class MemoryIOSink implements IOSink {
@override
Future
<
void
>
flush
()
async
{
}
void
clear
()
{
writes
.
clear
();
}
String
getAndClear
()
{
final
String
result
=
utf8
.
decode
(
writes
.
expand
((
List
<
int
>
l
)
=>
l
).
toList
());
clear
();
return
result
;
}
}
class
MemoryStdout
extends
MemoryIOSink
implements
io
.
Stdout
{
...
...
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