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

Unified Diff: pkg/docgen/test/single_library_test.dart

Issue 18089006: Single unit test for a single library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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/pubspec.yaml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/test/single_library_test.dart
diff --git a/pkg/docgen/test/single_library_test.dart b/pkg/docgen/test/single_library_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..8ef51f6a4f4ab024512946f35276059098a7e09b
--- /dev/null
+++ b/pkg/docgen/test/single_library_test.dart
@@ -0,0 +1,84 @@
+library single_library_test;
+
+import 'dart:io';
+
+import 'package:unittest/unittest.dart';
+
+import '../lib/docgen.dart';
+import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart';
+
+main() {
+ File file;
+ var mirrors;
+ Library library;
+
+ setUp(() {
+ file = new File('test.dart');
+ file.writeAsStringSync('''
Tate Mandel 2013/06/28 16:43:29 You can probably just include this file in the tes
+library test;
+/**
+ * Doc comment for class A.
+ *
+ * Multiline Test
+ */
+/*
+ * Normal comment for class A.
+ */
+class A {
+
+ /**
+ * Markdown _test_ for **class** [A]
+ */
+ int _someNumber;
+
+ A() {
+ _someNumber = 12;
+ }
+
+ void doThis(int a) {
+ print(a);
+ }
+}
+
+main() {
+ A a = new A();
+ a.doThis(5);
+}
+ ''');
+ parseSdk = false;
+ includePrivate = true;
+ includeSdk = false;
+ return getMirrorSystem(['test.dart']).then(expectAsync1((mirrorSystem) {
+ mirrors = mirrorSystem;
+ var testLibraryUri = currentDirectory.resolve('test.dart');
+ library = generateLibrary(mirrorSystem.libraries[testLibraryUri]);
+ }));
+ });
+
+ tearDown(() {
+ file.deleteSync();
+ });
+
+ test('Test library generated is of type Library', () {
Tate Mandel 2013/06/28 16:43:29 All of your tests are testing the same unit of cod
+ expect(library is Library, isTrue);
+ });
+
+ test('Test class generated is of type Class', () {
+ expect(library.classes.values.every((e) => e is Class), isTrue);
+ });
+
+ test('Test class methods generated are of type Method', () {
+ expect(library.classes.values.first.methods.values
+ .every((e) => e is Method), isTrue);
+ });
+
+ test('Test class method parameter for doThis generated is of type Parameter',
+ () {
+ expect(library.classes.values.first.methods['doThis'].parameters.values
Tate Mandel 2013/06/28 16:43:29 If you combine all of these tests into a single bl
+ .every((e) => e is Parameter), isTrue);
+ });
+
+ test('Test top-level functions generated are of type Method', () {
+ expect(library.functions.values.every((e) => e is Method), isTrue);
+ });
+}
« no previous file with comments | « pkg/docgen/pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698