-
-
Notifications
You must be signed in to change notification settings - Fork 186
Expand file tree
/
Copy pathflutter_gen_command_test.dart
More file actions
70 lines (63 loc) · 1.96 KB
/
Copy pathflutter_gen_command_test.dart
File metadata and controls
70 lines (63 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import 'dart:io' show Platform;
import 'package:flutter_gen_core/version.gen.dart';
import 'package:test/test.dart';
import 'package:test_process/test_process.dart';
final separator = Platform.pathSeparator;
void main() {
test('Execute fluttergen', () async {
final process = await TestProcess.start(
'dart',
['bin/flutter_gen_command.dart'],
);
expect(
await process.stdout.next,
equals('[FlutterGen] v$packageVersion Loading ...'),
);
await process.shouldExit(0);
});
test('Execute fluttergen --config pubspec.yaml', () async {
var process = await TestProcess.start(
'dart',
['bin/flutter_gen_command.dart', '--config', 'pubspec.yaml'],
);
expect(
await process.stdout.next,
equals('[FlutterGen] v$packageVersion Loading ...'),
);
await process.shouldExit(0);
});
test('Execute fluttergen --help', () async {
var process = await TestProcess.start(
'dart',
['bin/flutter_gen_command.dart', '--help'],
);
expect(await process.stdout.next,
equals('-c, --config Set the path of pubspec.yaml.'));
final line = await process.stdout.next;
expect(line.trim(), equals('(defaults to "pubspec.yaml")'));
await process.shouldExit(0);
});
test('Execute fluttergen --version', () async {
var process = await TestProcess.start(
'dart',
['bin/flutter_gen_command.dart', '--version'],
);
expect(await process.stdout.next, equals('[FlutterGen] v$packageVersion'));
await process.shouldExit(0);
});
test('Execute wrong argments with fluttergen --wrong', () async {
var process = await TestProcess.start(
'dart',
['bin/flutter_gen_command.dart', '--wrong'],
);
expect(
await process.stderr.next,
equals('Could not find an option named "wrong".'),
);
expect(
await process.stderr.next,
equals('usage: flutter_gen [options...]'),
);
await process.shouldExit(0);
});
}