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

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 test('Single file test.', () {
Andrei Mouravski 2013/07/01 19:54:29 I'd recommend having a top level group and put thi
Emily Fortuna 2013/07/01 21:22:41 Disagree. Groups are only useful if you have multi
Andrei Mouravski 2013/07/01 21:43:53 * Disabling tests in status files requires groups.
Emily Fortuna 2013/07/01 21:45:16 I stand corrected.
12 var file = new File('test.dart');
13 file.writeAsStringSync('''
14 library test;
15 /**
16 * Doc comment for class A.
17 *
18 * Multiline Test
19 */
20 /*
21 * Normal comment for class A.
22 */
23 class A {
24
25 /**
26 * Markdown _test_ for **class** [A]
27 */
28 int _someNumber;
29
30 A() {
31 _someNumber = 12;
32 }
33
34 void doThis(int a) {
35 print(a);
36 }
37 }
38
39 main() {
40 A a = new A();
41 a.doThis(5);
42 }
43 ''');
44
45 parseSdk = false;
46 includePrivate = true;
47 includeSdk = false;
48 getMirrorSystem(['test.dart']).then(expectAsync1((mirrorSystem) {
Emily Fortuna 2013/07/01 21:22:41 You can change this test to not use expectAsync be
49 var testLibraryUri = currentDirectory.resolve('test.dart');
50 var library = generateLibrary(mirrorSystem.libraries[testLibraryUri]);
51 expect(library is Library, isTrue);
52
53 var classes = library.classes.values;
54 expect(classes.every((e) => e is Class), isTrue);
55
56 var classMethods = [];
57 classes.forEach((e) => classMethods.addAll(e.methods.values));
58 expect(classMethods.every((e) => e is Method), isTrue);
59
60 var methodParameters = [];
61 classMethods.forEach((e) => methodParameters.addAll(e.parameters.values));
62 expect(methodParameters.every((e) => e is Parameter), isTrue);
63
64 var functions = library.functions.values;
65 expect(functions.every((e) => e is Method), isTrue);
66
67 var functionParameters = [];
68 functions.forEach((e) => functionParameters.addAll(e.parameters.values));
69 expect(functionParameters.every((e) => e is Parameter), isTrue);
70
71 var variables = library.variables.values;
72 expect(variables.every((e) => e is Variable), isTrue);
73
74 file.deleteSync();
75 }));
76 });
77 }
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