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

Side by Side 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, 5 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/pubspec.yaml ('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
(Empty)
1 library single_library_test;
2
3 import 'dart:io';
4
5 import 'package:unittest/unittest.dart';
6
7 import '../lib/docgen.dart';
8 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart';
9
10 main() {
11 File file;
12 var mirrors;
13 Library library;
14
15 setUp(() {
16 file = new File('test.dart');
17 file.writeAsStringSync('''
Tate Mandel 2013/06/28 16:43:29 You can probably just include this file in the tes
18 library test;
19 /**
20 * Doc comment for class A.
21 *
22 * Multiline Test
23 */
24 /*
25 * Normal comment for class A.
26 */
27 class A {
28
29 /**
30 * Markdown _test_ for **class** [A]
31 */
32 int _someNumber;
33
34 A() {
35 _someNumber = 12;
36 }
37
38 void doThis(int a) {
39 print(a);
40 }
41 }
42
43 main() {
44 A a = new A();
45 a.doThis(5);
46 }
47 ''');
48 parseSdk = false;
49 includePrivate = true;
50 includeSdk = false;
51 return getMirrorSystem(['test.dart']).then(expectAsync1((mirrorSystem) {
52 mirrors = mirrorSystem;
53 var testLibraryUri = currentDirectory.resolve('test.dart');
54 library = generateLibrary(mirrorSystem.libraries[testLibraryUri]);
55 }));
56 });
57
58 tearDown(() {
59 file.deleteSync();
60 });
61
62 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
63 expect(library is Library, isTrue);
64 });
65
66 test('Test class generated is of type Class', () {
67 expect(library.classes.values.every((e) => e is Class), isTrue);
68 });
69
70 test('Test class methods generated are of type Method', () {
71 expect(library.classes.values.first.methods.values
72 .every((e) => e is Method), isTrue);
73 });
74
75 test('Test class method parameter for doThis generated is of type Parameter',
76 () {
77 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
78 .every((e) => e is Parameter), isTrue);
79 });
80
81 test('Test top-level functions generated are of type Method', () {
82 expect(library.functions.values.every((e) => e is Method), isTrue);
83 });
84 }
OLDNEW
« 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