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

Side by Side Diff: tests/standalone/src/TestRunnerTest.dart

Issue 8440066: Add test_runner.dart to Dart version of test scripts. Include TestRunnerTest unit test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Skip TimeoutTest on dartium Created 9 years, 1 month 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
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
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.
4
5 #library("TestRunnerTest");
6
7
8 #import("../../../tools/testing/dart/test_runner.dart");
9
10 class TestController {
11 static final int numTests = 4;
12 static int numCompletedTests = 0;
13
14 // Used as TestCase.completedCallback.
15 static processCompletedTest(TestCase testCase) {
16 TestOutput output = testCase.output;
17 print("Test: ${testCase.commandLine}");
18 if (output.unexpectedOutput) {
19 print("Unexpected output: ${output.result}");
20 }
21 print("stdout: ");
22 for (var line in output.stdout) print(line);
23 print("stderr: ");
24 for (var line in output.stderr) print(line);
25
26 print("Time: ${output.time}");
27 print("Exit code: ${output.exitCode}");
28
29 ++numCompletedTests;
30 print("$numCompletedTests/$numTests");
31 if (numCompletedTests == numTests) {
32 TimerChecks.timer.cancel();
33 }
34 }
35 }
36
37 TestCase MakeTestCase(String testName, List<String> expectations) {
38 return new TestCase("out/Debug_ia32/dart_bin", <String>[
Søren Gjesse 2011/11/04 09:05:34 This path does not work cross platform/mode, see h
Bill Hesse 2011/11/04 14:49:22 Done.
39 "--ignore-unrecognized-flags",
40 "--enable_type_checks",
41 "tests/standalone/src/$testName.dart"],
Søren Gjesse 2011/11/04 09:05:34 Maybe use ${testName} for clarity.
Bill Hesse 2011/11/04 14:49:22 Done.
42 TestController.processCompletedTest,
43 new Set<String>.from(expectations));
44 }
45
46 void main() {
47 new RunningProcess(MakeTestCase("PassTest", [PASS]), 30).start();
48 new RunningProcess(MakeTestCase("FailTest", [FAIL]), 30).start();
49 new RunningProcess(MakeTestCase("TimeoutTest", [TIMEOUT]), 30).start();
50 new RunningProcess(MakeTestCase("CrashTest", [CRASH]), 30).start();
51 Expect.equals(4, TestController.numTests);
52 Expect.throws(() =>
Mads Ager (google) 2011/11/04 09:06:13 Funky indentation and you don't need the () => ...
Bill Hesse 2011/11/04 14:49:22 Done.
53 new RunningProcess(MakeTestCase("CrashTest", [SKIP]), 30).start()
54 );
55 }
56
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698