Unverified Commit fbd29b88 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] fix formatting regression in analyze and add full coverage (#62593)

parent 12397fba
......@@ -144,7 +144,7 @@ abstract class AnalyzeBase {
if (undocumentedMembers > 0) {
errorsMessage.write(' (ran in ${seconds}s; $dartDocMessage)');
} else {
errorsMessage.write(' (ran in ${seconds}s;)');
errorsMessage.write(' (ran in ${seconds}s)');
}
return errorsMessage.toString();
}
......
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_tools/src/commands/analyze_base.dart';
import '../../src/common.dart';
void main() {
testWithoutContext('AnalyzeBase message formatting with zero issues', () async {
final String message = AnalyzeBase.generateErrorsMessage(
issueCount: 0,
seconds: '10',
undocumentedMembers: 0,
);
expect(message, 'No issues found! (ran in 10s)');
});
testWithoutContext('AnalyzeBase message formatting with undocumented issues', () async {
final String message = AnalyzeBase.generateErrorsMessage(
issueCount: 0,
seconds: '10',
undocumentedMembers: 1,
dartDocMessage: 'test'
);
expect(message, 'No issues found! (ran in 10s; test)');
});
testWithoutContext('AnalyzeBase message formatting with one issue', () async {
final String message = AnalyzeBase.generateErrorsMessage(
issueCount: 1,
seconds: '10',
undocumentedMembers: 0,
);
expect(message, '1 issue found. (ran in 10s)');
});
testWithoutContext('AnalyzeBase message formatting with N issues', () async {
final String message = AnalyzeBase.generateErrorsMessage(
issueCount: 10,
seconds: '10',
undocumentedMembers: 0,
);
expect(message, '10 issues found. (ran in 10s)');
});
testWithoutContext('AnalyzeBase message with analyze files', () async {
final String message = AnalyzeBase.generateErrorsMessage(
issueCount: 0,
seconds: '10',
undocumentedMembers: 0,
files: 10,
);
expect(message, 'No issues found! • analyzed 10 files (ran in 10s)');
});
testWithoutContext('AnalyzeBase message with positive issue diff', () async {
final String message = AnalyzeBase.generateErrorsMessage(
issueCount: 1,
seconds: '10',
undocumentedMembers: 0,
issueDiff: 1,
);
expect(message, '1 issue found. (1 new) (ran in 10s)');
});
testWithoutContext('AnalyzeBase message with negative issue diff', () async {
final String message = AnalyzeBase.generateErrorsMessage(
issueCount: 0,
seconds: '10',
undocumentedMembers: 0,
issueDiff: -1,
);
expect(message, 'No issues found! (1 fixed) (ran in 10s)');
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment