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

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

Issue 203753005: pkg/docgen: test fixes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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/single_library_test.dart ('k') | pkg/docgen/test/util.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library docgen.test.typedef;
6
7 import 'dart:convert';
8 import 'dart:io';
9
10 import 'package:path/path.dart' as p;
11 import 'package:scheduled_test/descriptor.dart' as d;
12 import 'package:scheduled_test/scheduled_test.dart';
13 import 'package:unittest/matcher.dart';
14
15 import 'util.dart';
16 import '../lib/docgen.dart' as dg;
17
18 void main() {
19
20 setUp(() {
21 scheduleTempDir();
22 });
23
24 test('typedef gen', () {
25 schedule(() {
26 var codeDir = getMultiLibraryCodePath();
27 expect(FileSystemEntity.isDirectorySync(codeDir), isTrue);
28 return dg.docgen([codeDir], out: p.join(d.defaultRoot, 'docs'));
29 });
30
31 schedule(() {
32 var path = p.join(d.defaultRoot, 'docs', 'test_lib-bar.json');
33 var dartCoreJson = new File(path).readAsStringSync();
34
35 var testLibBar = JSON.decode(dartCoreJson) as Map<String, dynamic>;
36
37 //
38 // Validate function doc references
39 //
40 var generateFoo = testLibBar['functions']['methods']['generateFoo']
41 as Map<String, dynamic>;
42
43 expect(generateFoo['comment'], '<p><a>test_lib-bar.generateFoo.input</a> '
44 'is of type <a>test_lib-bar.C</a> returns an <a>test_lib.A</a>.</p>');
45
46 var classes = testLibBar['classes'] as Map<String, dynamic>;
47
48 expect(classes, hasLength(3));
49
50 expect(classes['class'], isList);
51 expect(classes['error'], isList);
52
53 var typeDefs = classes['typedef'] as Map<String, dynamic>;
54 var comparator = typeDefs['AnATransformer'] as Map<String, dynamic>;
55
56 var expectedPreview = '<p>Processes a [C] instance for testing.</p>';
57
58 expect(comparator['preview'], expectedPreview);
59
60 var expectedComment = expectedPreview + '\n'
61 '<p>To eliminate import warnings for [A] and to test typedefs.</p>';
62
63 expect(comparator['comment'], expectedComment);
64 });
65 });
66 }
OLDNEW
« no previous file with comments | « pkg/docgen/test/single_library_test.dart ('k') | pkg/docgen/test/util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698