mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 02:27:39 +00:00
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:
parent
fa54a92970
commit
c6dd41bfb3
|
@ -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));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue