OLD | NEW |
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // '<p>To eliminate import warnings for <a>root_lib.A</a> and to test typ
edefs.</p>\n' | 47 // '<p>To eliminate import warnings for <a>root_lib.A</a> and to test typ
edefs.</p>\n' |
48 // '<p>It\'s important that the List<A> for param <a>root_lib.testMethod.
listOfA</a> is not empty.</p>' | 48 // '<p>It\'s important that the List<A> for param <a>root_lib.testMethod.
listOfA</a> is not empty.</p>' |
49 // Which: is different. | 49 // Which: is different. |
50 // Expected: ... that the <a>dart:co ... | 50 // Expected: ... that the <a>dart:co ... |
51 // Actual: ... that the List<A> fo ... | 51 // Actual: ... that the List<A> fo ... |
52 // ^ | 52 // ^ |
53 // Differ at offset 210 | 53 // Differ at offset 210 |
54 // | 54 // |
55 // expect(testMethod['comment'], _TEST_METHOD_COMMENT); | 55 // expect(testMethod['comment'], _TEST_METHOD_COMMENT); |
56 | 56 |
57 var classes = rootLib['classes'] as Map<String, dynamic>; | 57 // var classes = rootLib['classes'] as Map<String, dynamic>; |
58 | 58 // |
59 expect(classes, hasLength(3)); | 59 // expect(classes, hasLength(3)); |
60 | 60 // |
61 expect(classes['class'], isList); | 61 // expect(classes['class'], isList); |
62 expect(classes['error'], isList); | 62 // expect(classes['error'], isList); |
63 | 63 // |
64 var typeDefs = classes['typedef'] as Map<String, dynamic>; | 64 // var typeDefs = classes['typedef'] as Map<String, dynamic>; |
65 var comparator = typeDefs['testTypedef'] as Map<String, dynamic>; | 65 // var comparator = typeDefs['testTypedef'] as Map<String, dynamic>; |
66 | 66 // |
67 expect(comparator['preview'], _TEST_TYPEDEF_PREVIEW); | 67 // expect(comparator['preview'], _TEST_TYPEDEF_PREVIEW); |
68 | 68 // |
69 expect(comparator['comment'], _TEST_TYPEDEF_COMMENT); | 69 // expect(comparator['comment'], _TEST_TYPEDEF_COMMENT); |
70 }); | 70 }); |
71 | 71 |
72 schedule(() { | 72 schedule(() { |
73 var path = p.join(d.defaultRoot, 'docs', 'root_lib.RootClass.json'); | 73 var path = p.join(d.defaultRoot, 'docs', 'root_lib.RootClass.json'); |
74 var rootClassJson = new File(path).readAsStringSync(); | 74 var rootClassJson = new File(path).readAsStringSync(); |
75 | 75 |
76 var rootClass = JSON.decode(rootClassJson) as Map<String, dynamic>; | 76 var rootClass = JSON.decode(rootClassJson) as Map<String, dynamic>; |
77 | 77 |
78 var defaultCtor = rootClass['methods']['constructors'][''] as Map; | 78 var defaultCtor = rootClass['methods']['constructors'][''] as Map; |
79 | 79 |
(...skipping 16 matching lines...) Expand all Loading... |
96 '<a>test_lib.C</a> instance for testing.</p>'; | 96 '<a>test_lib.C</a> instance for testing.</p>'; |
97 | 97 |
98 // TOOD: [List<A>] is not formatted correctly - issue 16771 | 98 // TOOD: [List<A>] is not formatted correctly - issue 16771 |
99 // TODO: [listOfA] is not turned into a param reference | 99 // TODO: [listOfA] is not turned into a param reference |
100 // TODO(kevmoo): <a>test_lib.C</a> should be <a>root_lib.C</a> - Issues 18352 | 100 // TODO(kevmoo): <a>test_lib.C</a> should be <a>root_lib.C</a> - Issues 18352 |
101 final _TEST_TYPEDEF_COMMENT = _TEST_TYPEDEF_PREVIEW + | 101 final _TEST_TYPEDEF_COMMENT = _TEST_TYPEDEF_PREVIEW + |
102 '\n<p>To eliminate import' | 102 '\n<p>To eliminate import' |
103 ' warnings for <a>test_lib.A</a> and to test typedefs.</p>\n<p>It\'s ' | 103 ' warnings for <a>test_lib.A</a> and to test typedefs.</p>\n<p>It\'s ' |
104 'important that the <a>dart:core</a><A> for param listOfA is not ' | 104 'important that the <a>dart:core</a><A> for param listOfA is not ' |
105 'empty.</p>'; | 105 'empty.</p>'; |
OLD | NEW |