OLD | NEW |
1 import 'dart:convert'; | 1 import 'dart:convert'; |
2 import 'dart:io'; | 2 import 'dart:io'; |
3 | 3 |
4 import 'package:path/path.dart' as p; | 4 import 'package:path/path.dart' as p; |
5 import 'package:scheduled_test/descriptor.dart' as d; | 5 import 'package:scheduled_test/descriptor.dart' as d; |
6 import 'package:scheduled_test/scheduled_test.dart'; | 6 import 'package:scheduled_test/scheduled_test.dart'; |
7 | 7 |
8 import 'util.dart'; | 8 import 'util.dart'; |
9 import '../lib/docgen.dart' as dg; | 9 import '../lib/docgen.dart' as dg; |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 }); | 21 }); |
22 }); | 22 }); |
23 | 23 |
24 currentSchedule.onComplete.schedule(() { | 24 currentSchedule.onComplete.schedule(() { |
25 d.defaultRoot = null; | 25 d.defaultRoot = null; |
26 return tempDir.delete(recursive: true); | 26 return tempDir.delete(recursive: true); |
27 }); | 27 }); |
28 }); | 28 }); |
29 | 29 |
30 test('json output', () { | 30 test('json output', () { |
31 print(d.defaultRoot); | |
32 | |
33 schedule(() { | 31 schedule(() { |
34 var codeDir = getMultiLibraryCodePath(); | 32 var codeDir = getMultiLibraryCodePath(); |
35 expect(FileSystemEntity.isDirectorySync(codeDir), isTrue); | 33 expect(FileSystemEntity.isDirectorySync(codeDir), isTrue); |
36 return dg.docgen(['$codeDir/'], out: p.join(d.defaultRoot, 'docs')); | 34 return dg.docgen(['$codeDir/'], out: p.join(d.defaultRoot, 'docs')); |
37 }); | 35 }); |
38 | 36 |
39 d.dir('docs', [ | 37 d.dir('docs', [ |
40 d.matcherFile('index.json', _isJsonMap), | 38 d.matcherFile('index.json', _isJsonMap), |
41 d.matcherFile('index.txt', isNotNull), | 39 d.matcherFile('index.txt', isNotNull), |
42 d.matcherFile('library_list.json', _isJsonMap), | 40 d.matcherFile('library_list.json', _isJsonMap), |
43 d.matcherFile('testLib-bar.C.json', _isJsonMap), | 41 d.matcherFile('testLib-bar.C.json', _isJsonMap), |
44 d.matcherFile('testLib-bar.json', _isJsonMap), | 42 d.matcherFile('testLib-bar.json', _isJsonMap), |
45 d.matcherFile('testLib.A.json', _isJsonMap), | 43 d.matcherFile('testLib.A.json', _isJsonMap), |
46 d.matcherFile('testLib.B.json', _isJsonMap), | 44 d.matcherFile('testLib.B.json', _isJsonMap), |
47 d.matcherFile('testLib.C.json', _isJsonMap), | 45 d.matcherFile('testLib.C.json', _isJsonMap), |
48 d.matcherFile('testLib.json', _isJsonMap), | 46 d.matcherFile('testLib.json', _isJsonMap), |
49 d.matcherFile('testLib2-foo.B.json', _isJsonMap), | 47 d.matcherFile('testLib2-foo.B.json', _isJsonMap), |
50 d.matcherFile('testLib2-foo.json', _isJsonMap) | 48 d.matcherFile('testLib2-foo.json', _isJsonMap) |
51 ]).validate(); | 49 ]).validate(); |
52 }); | 50 }); |
53 } | 51 } |
54 | 52 |
55 final Matcher _isJsonMap = predicate((input) { | 53 final Matcher _isJsonMap = predicate((input) { |
56 try { | 54 try { |
57 return JSON.decode(input) is Map; | 55 return JSON.decode(input) is Map; |
58 } catch (e) { | 56 } catch (e) { |
59 return false; | 57 return false; |
60 } | 58 } |
61 }, 'Output is JSON encoded Map'); | 59 }, 'Output is JSON encoded Map'); |
OLD | NEW |