Add tests to dartdev that assert that all found usageLineLengths are the same and null

Change-Id: Ia20fca45eb5ace79751bc1060ec5e1ebf10212ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140802
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
This commit is contained in:
Jaime Wren 2020-03-24 21:53:19 +00:00 committed by commit-bot@chromium.org
parent fa54a92970
commit c6dd41bfb3

View file

@ -9,9 +9,32 @@ import 'package:test/test.dart';
import '../utils.dart';
void main() {
group('command', command);
group('flag', help);
}
void command() {
// For each command description, assert that the values are not empty, don't
// have trailing white space and end with a period.
test('description formatting', () {
DartdevRunner([]).commands.forEach((String commandKey, Command command) {
expect(commandKey, isNotEmpty);
expect(command.description, isNotEmpty);
expect(command.description, endsWith('.'));
expect(command.description.trim(), equals(command.description));
});
});
// Assert that all found usageLineLengths are the same and null
test('argParser usageLineLength isNull', () {
DartdevRunner([]).commands.forEach((String commandKey, Command command) {
if (command.argParser != null) {
expect(command.argParser.usageLineLength, isNull);
}
});
});
}
void help() {
TestProject p;
@ -48,15 +71,4 @@ void help() {
expect(result.exitCode, 0);
expect(result.stdout, contains('migrate '));
});
// For each command description, assert that the values are not empty, don't
// have trailing white space and end with a period.
test('description formatting', () {
DartdevRunner([]).commands.forEach((String commandKey, Command command) {
expect(commandKey, isNotEmpty);
expect(command.description, isNotEmpty);
expect(command.description, endsWith('.'));
expect(command.description.trim(), equals(command.description));
});
});
}