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

Side by Side Diff: lib/unittest/unittest_vm.dart

Issue 10031022: step 1 in making unittest platform independent. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * A simple unit test library for running tests on the VM. 6 * A simple unit test library for running tests on the VM.
7 */ 7 */
8 #library('unittest'); 8 #library('unittest');
9 9
10 #import('dart:io'); 10 #import('dart:io');
11 #import('dart:isolate');
12
13 #source('config.dart');
11 #source('shared.dart'); 14 #source('shared.dart');
12 15
13 _platformInitialize() { 16 class PlatformConfiguration implements Configuration {
Bob Nystrom 2012/04/10 20:04:25 StandaloneConfiguration
Siggi Cherem (dart-lang) 2012/04/10 21:40:18 see other comments.
14 // Do nothing. 17 void onInit() {}
Bob Nystrom 2012/04/10 20:04:25 Remove this.
Siggi Cherem (dart-lang) 2012/04/10 21:40:18 Done - :(, forgot to do a git cl upload
18 void onStart() {}
Bob Nystrom 2012/04/10 20:04:25 And this.
Siggi Cherem (dart-lang) 2012/04/10 21:40:18 Done.
19 void onTestResult(TestCase testCase) {}
20 void onDone(int testsPassed, int testsFailed, int testsErrors,
21 List<TestCase> results) {
22 // Print each test's result.
23 for (final test in _tests) {
24 print('${test.result.toUpperCase()}: ${test.description}');
25
26 if (test.message != '') {
27 print(' ${test.message}');
28 }
29 }
30
31 // Show the summary.
32 print('');
33
34 var success = false;
35 if (testsPassed == 0 && testsFailed == 0 && testsErrors == 0) {
36 print('No tests found.');
37 // This is considered a failure too: if this happens you probably have a
38 // bug in your unit tests.
39 } else if (testsFailed == 0 && testsErrors == 0) {
40 print('All $testsPassed tests passed.');
41 success = true;
42 } else {
43 print('$testsPassed PASSED, $testsFailed FAILED, $testsErrors ERRORS');
44 }
45
46 // A non-zero exit code is used by the test infrastructure to detect failure .
eub 2012/04/10 18:06:02 80 cols
Siggi Cherem (dart-lang) 2012/04/10 21:40:18 Done.
47 if (!success) exit(1);
48 }
15 } 49 }
16
17 _platformDefer(void callback()) {
18 new Timer(0, (timer) {
19 callback();
20 });
21 }
22
23 _platformStartTests() {
24 // Do nothing.
25 }
26
27 _platformCompleteTests(int testsPassed, int testsFailed, int testsErrors) {
28 // Print each test's result.
29 for (final test in _tests) {
30 print('${test.result.toUpperCase()}: ${test.description}');
31
32 if (test.message != '') {
33 print(' ${test.message}');
34 }
35 }
36
37 // Show the summary.
38 print('');
39
40 var success = false;
41 if (testsPassed == 0 && testsFailed == 0 && testsErrors == 0) {
42 print('No tests found.');
43 // This is considered a failure too: if this happens you probably have a
44 // bug in your unit tests.
45 } else if (testsFailed == 0 && testsErrors == 0) {
46 print('All $testsPassed tests passed.');
47 success = true;
48 } else {
49 print('$testsPassed PASSED, $testsFailed FAILED, $testsErrors ERRORS');
50 }
51
52 // A non-zero exit code is used by the test infrastructure to detect failure.
53 if (!success) exit(1);
54 }
OLDNEW
« lib/unittest/unittest_html.dart ('K') | « lib/unittest/unittest_node.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698