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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/docgen/test/single_library_test.dart ('k') | pkg/docgen/test/util.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/test/typedef_test.dart
diff --git a/pkg/docgen/test/typedef_test.dart b/pkg/docgen/test/typedef_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5defa66422df1b204c6f207e4adda6fbfff2ba61
--- /dev/null
+++ b/pkg/docgen/test/typedef_test.dart
@@ -0,0 +1,66 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library docgen.test.typedef;
+
+import 'dart:convert';
+import 'dart:io';
+
+import 'package:path/path.dart' as p;
+import 'package:scheduled_test/descriptor.dart' as d;
+import 'package:scheduled_test/scheduled_test.dart';
+import 'package:unittest/matcher.dart';
+
+import 'util.dart';
+import '../lib/docgen.dart' as dg;
+
+void main() {
+
+ setUp(() {
+ scheduleTempDir();
+ });
+
+ test('typedef gen', () {
+ schedule(() {
+ var codeDir = getMultiLibraryCodePath();
+ expect(FileSystemEntity.isDirectorySync(codeDir), isTrue);
+ return dg.docgen([codeDir], out: p.join(d.defaultRoot, 'docs'));
+ });
+
+ schedule(() {
+ var path = p.join(d.defaultRoot, 'docs', 'test_lib-bar.json');
+ var dartCoreJson = new File(path).readAsStringSync();
+
+ var testLibBar = JSON.decode(dartCoreJson) as Map<String, dynamic>;
+
+ //
+ // Validate function doc references
+ //
+ var generateFoo = testLibBar['functions']['methods']['generateFoo']
+ as Map<String, dynamic>;
+
+ expect(generateFoo['comment'], '<p><a>test_lib-bar.generateFoo.input</a> '
+ 'is of type <a>test_lib-bar.C</a> returns an <a>test_lib.A</a>.</p>');
+
+ var classes = testLibBar['classes'] as Map<String, dynamic>;
+
+ expect(classes, hasLength(3));
+
+ expect(classes['class'], isList);
+ expect(classes['error'], isList);
+
+ var typeDefs = classes['typedef'] as Map<String, dynamic>;
+ var comparator = typeDefs['AnATransformer'] as Map<String, dynamic>;
+
+ var expectedPreview = '<p>Processes a [C] instance for testing.</p>';
+
+ expect(comparator['preview'], expectedPreview);
+
+ var expectedComment = expectedPreview + '\n'
+ '<p>To eliminate import warnings for [A] and to test typedefs.</p>';
+
+ expect(comparator['comment'], expectedComment);
+ });
+ });
+}
« 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