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
349d694f
Unverified
Commit
349d694f
authored
Oct 30, 2019
by
Jonah Williams
Committed by
GitHub
Oct 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Added a null check for ranges in the sourceReport map. (#43667)" (#43827)
This reverts commit
0dc5ea4a
.
parent
8f704840
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
440 deletions
+10
-440
coverage_collector.dart
packages/flutter_tools/lib/src/test/coverage_collector.dart
+5
-22
coverage_collector_test.dart
...ter_tools/test/general.shard/coverage_collector_test.dart
+5
-418
No files found.
packages/flutter_tools/lib/src/test/coverage_collector.dart
View file @
349d694f
...
...
@@ -245,37 +245,20 @@ void _buildCoverageMap(
final
Map
<
String
,
Map
<
int
,
int
>>
hitMaps
=
<
String
,
Map
<
int
,
int
>>{};
for
(
String
scriptId
in
scripts
.
keys
)
{
final
Map
<
String
,
dynamic
>
sourceReport
=
sourceReports
[
scriptId
];
final
Map
<
String
,
dynamic
>
scripts
=
sourceReport
[
'scripts'
];
final
List
<
Map
<
String
,
Object
>>
ranges
=
sourceReport
[
'ranges'
];
// Ranges may sometimes be null for a report.
if
(
ranges
==
null
||
scripts
==
null
)
{
continue
;
}
for
(
Map
<
String
,
dynamic
>
range
in
ranges
)
{
for
(
Map
<
String
,
dynamic
>
range
in
sourceReport
[
'ranges'
])
{
final
Map
<
String
,
dynamic
>
coverage
=
range
[
'coverage'
];
final
String
scriptIndex
=
range
[
'scriptIndex'
];
// Coverage reports may sometimes be null for a Script.
if
(
coverage
==
null
||
scriptIndex
==
null
)
{
continue
;
}
final
Map
<
String
,
dynamic
>
scriptRef
=
scripts
[
scriptIndex
];
if
(
scriptRef
==
null
)
{
if
(
coverage
==
null
)
{
continue
;
}
final
Map
<
String
,
dynamic
>
scriptRef
=
sourceReport
[
'scripts'
][
range
[
'scriptIndex'
]];
final
String
uri
=
scriptRef
[
'uri'
];
final
String
id
=
scriptRef
[
'id'
];
if
(
uri
==
null
||
id
==
null
)
{
continue
;
}
final
Map
<
String
,
Object
>
scriptById
=
scripts
[
id
];
if
(
scriptById
==
null
)
{
continue
;
}
hitMaps
[
uri
]
??=
<
int
,
int
>{};
final
Map
<
int
,
int
>
hitMap
=
hitMaps
[
uri
];
final
List
<
dynamic
>
hits
=
coverage
[
'hits'
];
final
List
<
dynamic
>
misses
=
coverage
[
'misses'
];
final
List
<
dynamic
>
tokenPositions
=
script
ById
[
'tokenPosTable'
];
final
List
<
dynamic
>
tokenPositions
=
script
s
[
scriptRef
[
'id'
]]
[
'tokenPosTable'
];
// The token positions can be null if the script has no coverable lines.
if
(
tokenPositions
==
null
)
{
continue
;
...
...
packages/flutter_tools/test/general.shard/coverage_collector_test.dart
View file @
349d694f
...
...
@@ -20,428 +20,15 @@ void main() {
test
(
'Coverage collector Can handle coverage sentinenl data'
,
()
async
{
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getScripts'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'type'
:
'Sentinel'
,
'kind'
:
'Collected'
,
'valueAsString'
:
'<collected>'
};
});
final
Map
<
String
,
Object
>
result
=
await
collect
(
null
,
(
String
predicate
)
=>
true
,
connector:
(
Uri
uri
)
async
{
return
mockVMService
;
});
expect
(
result
,
<
String
,
Object
>{
'type'
:
'CodeCoverage'
,
'coverage'
:
<
Object
>[]});
});
test
(
'Coverage collector can handle null scripts value'
,
()
async
{
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getScripts'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getSourceReport'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'ranges'
:
<
Map
<
String
,
Object
>>[<
String
,
Object
>{}]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getObject'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{};
});
final
Map
<
String
,
Object
>
result
=
await
collect
(
null
,
(
String
predicate
)
=>
true
,
connector:
(
Uri
uri
)
async
{
return
mockVMService
;
});
expect
(
result
,
<
String
,
Object
>{
'type'
:
'CodeCoverage'
,
'coverage'
:
<
Object
>[]});
});
test
(
'Coverage collector can handle null ranges value'
,
()
async
{
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getScripts'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getSourceReport'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
String
,
Object
>{}};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getObject'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{};
});
final
Map
<
String
,
Object
>
result
=
await
collect
(
null
,
(
String
predicate
)
=>
true
,
connector:
(
Uri
uri
)
async
{
return
mockVMService
;
});
expect
(
result
,
<
String
,
Object
>{
'type'
:
'CodeCoverage'
,
'coverage'
:
<
Object
>[]});
});
test
(
'Coverage collector can handle null scriptIndex values'
,
()
async
{
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getScripts'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getSourceReport'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
},
'ranges'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'coverage'
:
<
String
,
Object
>{}}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getObject'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{};
});
final
Map
<
String
,
Object
>
result
=
await
collect
(
null
,
(
String
predicate
)
=>
true
,
connector:
(
Uri
uri
)
async
{
return
mockVMService
;
});
expect
(
result
,
<
String
,
Object
>{
'type'
:
'CodeCoverage'
,
'coverage'
:
<
Object
>[]});
});
test
(
'Coverage collector can handle null scriptRef values'
,
()
async
{
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getScripts'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getSourceReport'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
},
'ranges'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'coverage'
:
<
String
,
Object
>{},
'scriptIndex'
:
'some_value'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getObject'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{};
});
final
Map
<
String
,
Object
>
result
=
await
collect
(
null
,
(
String
predicate
)
=>
true
,
connector:
(
Uri
uri
)
async
{
return
mockVMService
;
});
expect
(
result
,
<
String
,
Object
>{
'type'
:
'CodeCoverage'
,
'coverage'
:
<
Object
>[]});
});
test
(
'Coverage collector can handle null scriptRef uri values'
,
()
async
{
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getScripts'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getSourceReport'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
,
'index_0'
:
<
String
,
Object
>{}},
'ranges'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'coverage'
:
<
String
,
Object
>{},
'scriptIndex'
:
'index_0'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getObject'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{};
});
final
Map
<
String
,
Object
>
result
=
await
collect
(
null
,
(
String
predicate
)
=>
true
,
connector:
(
Uri
uri
)
async
{
return
mockVMService
;
});
expect
(
result
,
<
String
,
Object
>{
'type'
:
'CodeCoverage'
,
'coverage'
:
<
Object
>[]});
});
test
(
'Coverage collector can handle null scriptRef id values'
,
()
async
{
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getScripts'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getSourceReport'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
,
'index_0'
:
<
String
,
Object
>{
'uri'
:
'some_uri'
}
},
'ranges'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'coverage'
:
<
String
,
Object
>{},
'scriptIndex'
:
'index_0'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getObject'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{};
});
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'type'
:
'Sentinel'
,
'kind'
:
'Collected'
,
'valueAsString'
:
'<collected>'
};
});
final
Map
<
String
,
Object
>
result
=
await
collect
(
null
,
(
String
predicate
)
=>
true
,
connector:
(
Uri
uri
)
async
{
return
mockVMService
;
});
expect
(
result
,
<
String
,
Object
>{
'type'
:
'CodeCoverage'
,
'coverage'
:
<
Object
>[]});
});
test
(
'Coverage collector can handle null scriptById values'
,
()
async
{
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getScripts'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getSourceReport'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
,
'index_0'
:
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'01'
},
},
'ranges'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'coverage'
:
<
String
,
Object
>{},
'scriptIndex'
:
'index_0'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getObject'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{};
});
final
Map
<
String
,
Object
>
result
=
await
collect
(
null
,
(
String
predicate
)
=>
true
,
connector:
(
Uri
uri
)
async
{
return
mockVMService
;
});
expect
(
result
,
<
String
,
Object
>{
'type'
:
'CodeCoverage'
,
'coverage'
:
<
Object
>[]});
});
test
(
'Coverage collector can handle null tokenPosTable values'
,
()
async
{
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getScripts'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getSourceReport'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
,
'index_0'
:
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'01'
},
'01'
:
<
String
,
Object
>{},
},
'ranges'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'coverage'
:
<
String
,
Object
>{},
'scriptIndex'
:
'index_0'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getObject'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{};
});
final
Map
<
String
,
Object
>
result
=
await
collect
(
null
,
(
String
predicate
)
=>
true
,
connector:
(
Uri
uri
)
async
{
return
mockVMService
;
});
expect
(
result
,
<
String
,
Object
>{
'type'
:
'CodeCoverage'
,
'coverage'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'source'
:
'some_uri'
,
'script'
:
<
String
,
Object
>{
'type'
:
'@Script'
,
'fixedId'
:
true
,
'id'
:
'libraries/1/scripts/some_uri'
,
'uri'
:
'some_uri'
,
'_kind'
:
'library'
},
'hits'
:
<
Map
<
String
,
Object
>>[]
}
]
});
});
test
(
'Coverage collector can handle null hits values'
,
()
async
{
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getScripts'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getSourceReport'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
,
'index_0'
:
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'01'
},
'01'
:
<
String
,
Object
>{
'tokenPosTable'
:
<
dynamic
>[]},
},
'ranges'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'coverage'
:
<
String
,
Object
>{},
'scriptIndex'
:
'index_0'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getObject'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{};
});
final
Map
<
String
,
Object
>
result
=
await
collect
(
null
,
(
String
predicate
)
=>
true
,
connector:
(
Uri
uri
)
async
{
return
mockVMService
;
});
expect
(
result
,
<
String
,
Object
>{
'type'
:
'CodeCoverage'
,
'coverage'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'source'
:
'some_uri'
,
'script'
:
<
String
,
Object
>{
'type'
:
'@Script'
,
'fixedId'
:
true
,
'id'
:
'libraries/1/scripts/some_uri'
,
'uri'
:
'some_uri'
,
'_kind'
:
'library'
},
'hits'
:
<
Map
<
String
,
Object
>>[]
}
]
});
});
test
(
'Coverage collector can handle null misses values'
,
()
async
{
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getScripts'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getSourceReport'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
,
'index_0'
:
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'01'
},
'01'
:
<
String
,
Object
>{
'tokenPosTable'
:
<
dynamic
>[]},
},
'ranges'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'coverage'
:
<
String
,
Object
>{
'hits'
:
<
dynamic
>[]},
'scriptIndex'
:
'index_0'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getObject'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{};
});
final
Map
<
String
,
Object
>
result
=
await
collect
(
null
,
(
String
predicate
)
=>
true
,
connector:
(
Uri
uri
)
async
{
return
mockVMService
;
});
expect
(
result
,
<
String
,
Object
>{
'type'
:
'CodeCoverage'
,
'coverage'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'source'
:
'some_uri'
,
'script'
:
<
String
,
Object
>{
'type'
:
'@Script'
,
'fixedId'
:
true
,
'id'
:
'libraries/1/scripts/some_uri'
,
'uri'
:
'some_uri'
,
'_kind'
:
'library'
},
'hits'
:
<
Map
<
String
,
Object
>>[]
}
]
});
});
test
(
'Coverage collector should process hits and misses'
,
()
async
{
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getScripts'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getSourceReport'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'scripts'
:
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'some_id'
,
'index_0'
:
<
String
,
Object
>{
'uri'
:
'some_uri'
,
'id'
:
'01'
},
'01'
:
<
String
,
Object
>{
'tokenPosTable'
:
<
dynamic
>[
<
int
>[
1
,
100
,
5
,
101
,
8
],
<
int
>[
2
,
102
,
7
],
]
},
},
'ranges'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'coverage'
:
<
String
,
Object
>{
'hits'
:
<
dynamic
>[
100
,
101
],
'misses'
:
<
dynamic
>[
102
],
},
'scriptIndex'
:
'index_0'
}
]
};
});
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getObject'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{};
});
final
Map
<
String
,
Object
>
result
=
await
collect
(
null
,
(
String
predicate
)
=>
true
,
connector:
(
Uri
uri
)
async
{
return
mockVMService
;
});
expect
(
result
,
<
String
,
Object
>{
'type'
:
'CodeCoverage'
,
'coverage'
:
<
Map
<
String
,
Object
>>[
<
String
,
Object
>{
'source'
:
'some_uri'
,
'script'
:
<
String
,
Object
>{
'type'
:
'@Script'
,
'fixedId'
:
true
,
'id'
:
'libraries/1/scripts/some_uri'
,
'uri'
:
'some_uri'
,
'_kind'
:
'library'
},
'hits'
:
<
int
>[
1
,
2
,
2
,
0
]
}
]
});
});
}
class
MockVMService
extends
Mock
implements
VMService
{
...
...
@@ -451,13 +38,13 @@ class MockVMService extends Mock implements VMService {
class
MockVM
extends
Mock
implements
VM
{
@override
final
List
<
MockIsolate
>
isolates
=
<
MockIsolate
>[
MockIsolate
()
];
final
List
<
MockIsolate
>
isolates
=
<
MockIsolate
>[
MockIsolate
()
];
}
class
MockIsolate
extends
Mock
implements
Isolate
{}
class
MockProcess
extends
Mock
implements
Process
{
final
Completer
<
int
>
completer
=
Completer
<
int
>();
final
Completer
<
int
>
completer
=
Completer
<
int
>();
@override
Future
<
int
>
get
exitCode
=>
completer
.
future
;
...
...
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