Declare locals as final where not reassigned (flutter_driver) (#8567)
This commit is contained in:
@@ -8,8 +8,8 @@ import 'package:flutter_driver/src/matcher_util.dart';
|
||||
void main() {
|
||||
group('match', () {
|
||||
test('matches', () {
|
||||
_TestMatcher matcher = new _TestMatcher(1);
|
||||
MatchResult ok = match(1, matcher);
|
||||
final _TestMatcher matcher = new _TestMatcher(1);
|
||||
final MatchResult ok = match(1, matcher);
|
||||
expect(ok.hasMatched, isTrue);
|
||||
expect(ok.mismatchDescription, isNull);
|
||||
expect(matcher.matchState1 is Map<dynamic, dynamic>, isTrue);
|
||||
@@ -17,8 +17,8 @@ void main() {
|
||||
});
|
||||
|
||||
test('mismatches', () {
|
||||
_TestMatcher matcher = new _TestMatcher(2);
|
||||
MatchResult fail = match(1, matcher);
|
||||
final _TestMatcher matcher = new _TestMatcher(2);
|
||||
final MatchResult fail = match(1, matcher);
|
||||
expect(fail.hasMatched, isFalse);
|
||||
expect(fail.mismatchDescription, 'mismatch!');
|
||||
expect(matcher.matchState1, matcher.matchState2);
|
||||
|
||||
@@ -15,7 +15,7 @@ void main() {
|
||||
|
||||
setUp(() {
|
||||
fakeAsync = new FakeAsync();
|
||||
Clock fakeClock = fakeAsync.getClock(new DateTime.now());
|
||||
final Clock fakeClock = fakeAsync.getClock(new DateTime.now());
|
||||
stopwatchFactory = () {
|
||||
return new FakeStopwatch(
|
||||
() => fakeClock.now().millisecondsSinceEpoch,
|
||||
|
||||
@@ -84,7 +84,7 @@ void main() {
|
||||
|
||||
group('computeMissedFrameBuildBudgetCount', () {
|
||||
test('computes the number of missed build budgets', () {
|
||||
TimelineSummary summary = summarize(<Map<String, dynamic>>[
|
||||
final TimelineSummary summary = summarize(<Map<String, dynamic>>[
|
||||
build(1000, 9000),
|
||||
build(11000, 1000),
|
||||
build(13000, 10000),
|
||||
@@ -176,7 +176,7 @@ void main() {
|
||||
|
||||
group('computeMissedFrameRasterizerBudgetCount', () {
|
||||
test('computes the number of missed rasterizer budgets', () {
|
||||
TimelineSummary summary = summarize(<Map<String, dynamic>>[
|
||||
final TimelineSummary summary = summarize(<Map<String, dynamic>>[
|
||||
begin(1000), end(10000),
|
||||
begin(11000), end(12000),
|
||||
begin(13000), end(23000),
|
||||
@@ -229,7 +229,7 @@ void main() {
|
||||
test('writes timeline to JSON file', () async {
|
||||
await summarize(<Map<String, String>>[<String, String>{'foo': 'bar'}])
|
||||
.writeTimelineToFile('test', destinationDirectory: tempDir.path);
|
||||
String written =
|
||||
final String written =
|
||||
await fs.file(path.join(tempDir.path, 'test.timeline.json')).readAsString();
|
||||
expect(written, '{"traceEvents":[{"foo":"bar"}]}');
|
||||
});
|
||||
@@ -243,7 +243,7 @@ void main() {
|
||||
build(11000, 1000),
|
||||
build(13000, 11000),
|
||||
]).writeSummaryToFile('test', destinationDirectory: tempDir.path);
|
||||
String written =
|
||||
final String written =
|
||||
await fs.file(path.join(tempDir.path, 'test.timeline_summary.json')).readAsString();
|
||||
expect(JSON.decode(written), <String, dynamic>{
|
||||
'average_frame_build_time_millis': 7.0,
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'package:flutter_driver/src/timeline.dart';
|
||||
void main() {
|
||||
group('Timeline', () {
|
||||
test('parses JSON', () {
|
||||
Timeline timeline = new Timeline.fromJson(<String, dynamic>{
|
||||
final Timeline timeline = new Timeline.fromJson(<String, dynamic>{
|
||||
'traceEvents': <Map<String, dynamic>>[
|
||||
<String, dynamic>{
|
||||
'name': 'test event',
|
||||
@@ -31,7 +31,7 @@ void main() {
|
||||
|
||||
expect(timeline.events, hasLength(2));
|
||||
|
||||
TimelineEvent e1 = timeline.events[0];
|
||||
final TimelineEvent e1 = timeline.events[0];
|
||||
expect(e1.name, 'test event');
|
||||
expect(e1.category, 'test category');
|
||||
expect(e1.phase, 'B');
|
||||
@@ -43,7 +43,7 @@ void main() {
|
||||
expect(e1.threadTimestampMicros, 567);
|
||||
expect(e1.arguments, <String, dynamic>{ 'arg1': true });
|
||||
|
||||
TimelineEvent e2 = timeline.events[1];
|
||||
final TimelineEvent e2 = timeline.events[1];
|
||||
expect(e2.name, isNull);
|
||||
expect(e2.category, isNull);
|
||||
expect(e2.phase, isNull);
|
||||
|
||||
Reference in New Issue
Block a user