Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: pkg/docgen/test/typedef_test.dart

Issue 245673002: pkg/docgen: a bunch of cleanup (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/docgen/test/multi_library_code/lib/root_lib.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library docgen.test.typedef; 5 library docgen.test.typedef;
6 6
7 import 'dart:convert'; 7 import 'dart:convert';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:path/path.dart' as p; 10 import 'package:path/path.dart' as p;
(...skipping 11 matching lines...) Expand all
22 22
23 test('typedef gen', () { 23 test('typedef gen', () {
24 schedule(() { 24 schedule(() {
25 var codeDir = getMultiLibraryCodePath(); 25 var codeDir = getMultiLibraryCodePath();
26 expect(FileSystemEntity.isDirectorySync(codeDir), isTrue); 26 expect(FileSystemEntity.isDirectorySync(codeDir), isTrue);
27 return dg.docgen([codeDir], out: p.join(d.defaultRoot, 'docs')); 27 return dg.docgen([codeDir], out: p.join(d.defaultRoot, 'docs'));
28 }); 28 });
29 29
30 schedule(() { 30 schedule(() {
31 var path = p.join(d.defaultRoot, 'docs', 'root_lib.json'); 31 var path = p.join(d.defaultRoot, 'docs', 'root_lib.json');
32 var dartCoreJson = new File(path).readAsStringSync(); 32 var rootLibJson = new File(path).readAsStringSync();
33 33
34 var testLibBar = JSON.decode(dartCoreJson) as Map<String, dynamic>; 34 var rootLib = JSON.decode(rootLibJson) as Map<String, dynamic>;
35 35
36 // 36 //
37 // Validate function doc references 37 // Validate function doc references
38 // 38 //
39 var testMethod = testLibBar['functions']['methods']['testMethod'] 39 var testMethod = rootLib['functions']['methods']['testMethod']
40 as Map<String, dynamic>; 40 as Map<String, dynamic>;
41 41
42 expect(testMethod['comment'], _TEST_METHOD_COMMENT); 42 expect(testMethod['comment'], _TEST_METHOD_COMMENT);
43 43
44 var classes = testLibBar['classes'] as Map<String, dynamic>; 44 var classes = rootLib['classes'] as Map<String, dynamic>;
45 45
46 expect(classes, hasLength(3)); 46 expect(classes, hasLength(3));
47 47
48 expect(classes['class'], isList); 48 expect(classes['class'], isList);
49 expect(classes['error'], isList); 49 expect(classes['error'], isList);
50 50
51 var typeDefs = classes['typedef'] as Map<String, dynamic>; 51 var typeDefs = classes['typedef'] as Map<String, dynamic>;
52 var comparator = typeDefs['testTypedef'] as Map<String, dynamic>; 52 var comparator = typeDefs['testTypedef'] as Map<String, dynamic>;
53 53
54 expect(comparator['preview'], _TEST_TYPEDEF_PREVIEW); 54 expect(comparator['preview'], _TEST_TYPEDEF_PREVIEW);
55 55
56 expect(comparator['comment'], _TEST_TYPEDEF_COMMENT); 56 expect(comparator['comment'], _TEST_TYPEDEF_COMMENT);
57 }); 57 });
58
59 schedule(() {
60 var path = p.join(d.defaultRoot, 'docs', 'root_lib.RootClass.json');
61 var rootClassJson = new File(path).readAsStringSync();
62
63 var rootClass = JSON.decode(rootClassJson) as Map<String, dynamic>;
64
65 var defaultCtor = rootClass['methods']['constructors'][''] as Map;
66
67 expect(defaultCtor['qualifiedName'], 'root_lib.RootClass.RootClass-');
68 });
58 }); 69 });
59 } 70 }
60 71
61 // TOOD: [List<A>] is not formatted correctly - issue 16771 72 // TOOD: [List<A>] is not formatted correctly - issue 16771
62 const _TEST_METHOD_COMMENT = '<p>Processes an ' 73 const _TEST_METHOD_COMMENT = '<p>Processes an '
63 '<a>root_lib.testMethod.input</a> of type <a>root_lib.C</a> ' 74 '<a>root_lib.testMethod.input</a> of type <a>root_lib.C</a> '
64 'instance for testing.</p>\n<p>To eliminate import warnings for ' 75 'instance for testing.</p>\n<p>To eliminate import warnings for '
65 '<a>root_lib.A</a> and to test typedefs.</p>\n<p>It\'s important that the' 76 '<a>root_lib.A</a> and to test typedefs.</p>\n<p>It\'s important that the'
66 ' <a>dart-core</a>&lt;A> for param <a>root_lib.testMethod.listOfA</a> ' 77 ' <a>dart-core</a>&lt;A> for param <a>root_lib.testMethod.listOfA</a> '
67 'is not empty.</p>'; 78 'is not empty.</p>';
68 79
69 // TODO: [input] is not turned into a param refenece 80 // TODO: [input] is not turned into a param refenece
70 const _TEST_TYPEDEF_PREVIEW = '<p>Processes an input of type ' 81 const _TEST_TYPEDEF_PREVIEW = '<p>Processes an input of type '
71 '<a>root_lib.C</a> instance for testing.</p>'; 82 '<a>root_lib.C</a> instance for testing.</p>';
72 83
73 // TOOD: [List<A>] is not formatted correctly - issue 16771 84 // TOOD: [List<A>] is not formatted correctly - issue 16771
74 // TODO: [listOfA] is not turned into a param reference 85 // TODO: [listOfA] is not turned into a param reference
75 final _TEST_TYPEDEF_COMMENT = _TEST_TYPEDEF_PREVIEW + '\n<p>To eliminate import' 86 final _TEST_TYPEDEF_COMMENT = _TEST_TYPEDEF_PREVIEW + '\n<p>To eliminate import'
76 ' warnings for <a>root_lib.A</a> and to test typedefs.</p>\n<p>It\'s ' 87 ' warnings for <a>root_lib.A</a> and to test typedefs.</p>\n<p>It\'s '
77 'important that the <a>dart-core</a>&lt;A> for param listOfA is not ' 88 'important that the <a>dart-core</a>&lt;A> for param listOfA is not '
78 'empty.</p>'; 89 'empty.</p>';
79 90
OLDNEW
« no previous file with comments | « pkg/docgen/test/multi_library_code/lib/root_lib.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698