-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsynthetic_input_test.dart
executable file
·51 lines (48 loc) · 1.45 KB
/
synthetic_input_test.dart
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
import 'package:exception_templates/exception_templates.dart';
import 'package:merging_builder/merging_builder.dart';
import 'package:test/test.dart';
/// Tests class `SyntheticInput`.
void main() {
final lib = LibDir();
final package = PackageDir();
group('SyntheticInput:', () {
test(r'instance<LibDir>()', () {
expect(SyntheticInput.instance<LibDir>(), lib);
});
test(r'instance<PackageDir>()', () {
expect(SyntheticInput.instance<PackageDir>(), package);
});
test('instance()', () {
expect(SyntheticInput.instance(), package);
});
test('isValidPath<\$Lib\$>(\'lib/*.dart\') => true', () {
expect(SyntheticInput.isValidPath<LibDir>('lib/*.dart'), true);
});
test('isValidPath<\$Lib\$>(\'test/*.dart\') => false', () {
expect(SyntheticInput.isValidPath<LibDir>('test/*.dart'), false);
});
test('validatePath<\$Lib\$>(\'test/*.dart\') | throws BuilderError', () {
try {
SyntheticInput.validatePath<LibDir>('test/*.dart');
} catch (e) {
expect(e, isA<ErrorOf<SyntheticInput>>());
}
});
});
group(r'LibDir:', () {
test('baseDirectory', () {
expect(lib.baseDirectory, 'lib');
});
test('value', () {
expect(lib.value, r'lib/$lib$');
});
});
group(r'PackageDir:', () {
test('baseDirectory', () {
expect(package.baseDirectory, '');
});
test('value', () {
expect(package.value, r'$package$');
});
});
}