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
2dfc86ea
Unverified
Commit
2dfc86ea
authored
Feb 02, 2021
by
Jonah Williams
Committed by
GitHub
Feb 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] remove mockito from flutter symbolize test (#75263)
parent
21f89fe0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
23 deletions
+23
-23
symbolize_test.dart
...er_tools/test/commands.shard/hermetic/symbolize_test.dart
+23
-23
No files found.
packages/flutter_tools/test/commands.shard/hermetic/symbolize_test.dart
View file @
2dfc86ea
...
@@ -8,12 +8,14 @@ import 'dart:async';
...
@@ -8,12 +8,14 @@ import 'dart:async';
import
'dart:typed_data'
;
import
'dart:typed_data'
;
import
'package:file/memory.dart'
;
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/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/cache.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/symbolize.dart'
;
import
'package:flutter_tools/src/commands/symbolize.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:meta/meta.dart'
;
import
'package:test/fake.dart'
;
import
'../../src/common.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/context.dart'
;
...
@@ -23,7 +25,6 @@ void main() {
...
@@ -23,7 +25,6 @@ void main() {
MemoryFileSystem
fileSystem
;
MemoryFileSystem
fileSystem
;
FakeStdio
stdio
;
FakeStdio
stdio
;
SymbolizeCommand
command
;
SymbolizeCommand
command
;
MockDwarfSymbolizationService
mockDwarfSymbolizationService
;
setUpAll
(()
{
setUpAll
(()
{
Cache
.
disableLocking
();
Cache
.
disableLocking
();
...
@@ -32,11 +33,10 @@ void main() {
...
@@ -32,11 +33,10 @@ void main() {
setUp
(()
{
setUp
(()
{
fileSystem
=
MemoryFileSystem
.
test
();
fileSystem
=
MemoryFileSystem
.
test
();
stdio
=
FakeStdio
();
stdio
=
FakeStdio
();
mockDwarfSymbolizationService
=
MockDwarfSymbolizationService
();
command
=
SymbolizeCommand
(
command
=
SymbolizeCommand
(
stdio:
stdio
,
stdio:
stdio
,
fileSystem:
fileSystem
,
fileSystem:
fileSystem
,
dwarfSymbolizationService:
mockDwarfSymbolizationService
,
dwarfSymbolizationService:
DwarfSymbolizationService
.
test
()
,
);
);
});
});
...
@@ -85,32 +85,23 @@ void main() {
...
@@ -85,32 +85,23 @@ void main() {
fileSystem
.
file
(
'app.debug'
).
writeAsBytesSync
(<
int
>[
1
,
2
,
3
]);
fileSystem
.
file
(
'app.debug'
).
writeAsBytesSync
(<
int
>[
1
,
2
,
3
]);
fileSystem
.
file
(
'foo.stack'
).
writeAsStringSync
(
'hello'
);
fileSystem
.
file
(
'foo.stack'
).
writeAsStringSync
(
'hello'
);
when
(
mockDwarfSymbolizationService
.
decode
(
input:
anyNamed
(
'input'
),
output:
anyNamed
(
'output'
),
symbols:
anyNamed
(
'symbols'
))
).
thenAnswer
((
Invocation
invocation
)
async
{
// Data is passed correctly to service
expect
((
await
(
invocation
.
namedArguments
[
#input
]
as
Stream
<
List
<
int
>>).
toList
()).
first
,
utf8
.
encode
(
'hello'
));
expect
(
invocation
.
namedArguments
[
#symbols
]
as
Uint8List
,
<
int
>[
1
,
2
,
3
,]);
return
;
});
await
createTestCommandRunner
(
command
)
await
createTestCommandRunner
(
command
)
.
run
(
const
<
String
>[
'symbolize'
,
'--debug-info=app.debug'
,
'--input=foo.stack'
,
'--output=results/foo.result'
]);
.
run
(
const
<
String
>[
'symbolize'
,
'--debug-info=app.debug'
,
'--input=foo.stack'
,
'--output=results/foo.result'
]);
expect
(
fileSystem
.
file
(
'results/foo.result'
),
exists
);
expect
(
fileSystem
.
file
(
'results/foo.result'
).
readAsBytesSync
(),
<
int
>[
104
,
101
,
108
,
108
,
111
,
10
]);
// hello
});
});
testUsingContext
(
'symbolize throws when DwarfSymbolizationService throws'
,
()
async
{
testUsingContext
(
'symbolize throws when DwarfSymbolizationService throws'
,
()
async
{
command
=
SymbolizeCommand
(
stdio:
stdio
,
fileSystem:
fileSystem
,
dwarfSymbolizationService:
ThrowingDwarfSymbolizationService
(),
);
fileSystem
.
file
(
'app.debug'
).
writeAsBytesSync
(<
int
>[
1
,
2
,
3
]);
fileSystem
.
file
(
'app.debug'
).
writeAsBytesSync
(<
int
>[
1
,
2
,
3
]);
fileSystem
.
file
(
'foo.stack'
).
writeAsStringSync
(
'hello'
);
fileSystem
.
file
(
'foo.stack'
).
writeAsStringSync
(
'hello'
);
when
(
mockDwarfSymbolizationService
.
decode
(
input:
anyNamed
(
'input'
),
output:
anyNamed
(
'output'
),
symbols:
anyNamed
(
'symbols'
))
).
thenThrow
(
ToolExit
(
'test'
));
expect
(
expect
(
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'symbolize'
,
'--debug-info=app.debug'
,
'--input=foo.stack'
,
'--output=results/foo.result'
]),
'symbolize'
,
'--debug-info=app.debug'
,
'--input=foo.stack'
,
'--output=results/foo.result'
]),
...
@@ -119,4 +110,13 @@ void main() {
...
@@ -119,4 +110,13 @@ void main() {
});
});
}
}
class
MockDwarfSymbolizationService
extends
Mock
implements
DwarfSymbolizationService
{}
class
ThrowingDwarfSymbolizationService
extends
Fake
implements
DwarfSymbolizationService
{
@override
Future
<
void
>
decode
({
@required
Stream
<
List
<
int
>>
input
,
@required
IOSink
output
,
@required
Uint8List
symbols
,
})
async
{
throwToolExit
(
'test'
);
}
}
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