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

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

Issue 8492013: Add asynchronous test suite runner to Dart rewrite of test scripts. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix TestRunnerTest to use new TestCase constructor. 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
1 1
2 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 #library("TestRunnerTest"); 6 #library("TestRunnerTest");
7 7
8 8
9 #import("../../../tools/testing/dart/test_runner.dart"); 9 #import("../../../tools/testing/dart/test_runner.dart");
10 10
(...skipping 26 matching lines...) Expand all
37 } 37 }
38 } 38 }
39 39
40 TestCase MakeTestCase(String testName, List<String> expectations) { 40 TestCase MakeTestCase(String testName, List<String> expectations) {
41 String test_path = "tests/standalone/src/${testName}.dart"; 41 String test_path = "tests/standalone/src/${testName}.dart";
42 // Working directory may be dart/runtime rather than dart. 42 // Working directory may be dart/runtime rather than dart.
43 if (!new File(test_path).existsSync()) { 43 if (!new File(test_path).existsSync()) {
44 test_path = "../tests/standalone/src/${testName}.dart"; 44 test_path = "../tests/standalone/src/${testName}.dart";
45 } 45 }
46 46
47 return new TestCase(getDartShellFileName(), 47 return new TestCase(testName, getDartShellFileName(),
Mads Ager (google) 2011/11/08 14:58:21 I would move argument two to a separate line.
48 <String>["--ignore-unrecognized-flags", 48 <String>["--ignore-unrecognized-flags",
49 "--enable_type_checks", 49 "--enable_type_checks",
50 test_path], 50 test_path],
51 TestController.processCompletedTest, 51 TestController.processCompletedTest,
52 new Set<String>.from(expectations)); 52 new Set<String>.from(expectations));
53 } 53 }
54 54
55 String getProcessTestFileName() { 55 String getProcessTestFileName() {
56 var names = ['out/Release_ia32/process_test', 56 var names = ['out/Release_ia32/process_test',
57 'out/Debug_ia32/process_test', 57 'out/Debug_ia32/process_test',
58 'xcodebuild/Release_ia32/process_test', 58 'xcodebuild/Release_ia32/process_test',
59 'xcodebuild/Debug_ia32/process_test', 59 'xcodebuild/Debug_ia32/process_test',
60 'Release_ia32/process_test.exe', 60 'Release_ia32/process_test.exe',
61 'Debug_ia32/process_test.exe']; 61 'Debug_ia32/process_test.exe'];
62 for (var name in names) { 62 for (var name in names) {
63 if (new File(name).existsSync()) { 63 if (new File(name).existsSync()) {
64 return name; 64 return name;
65 } 65 }
66 } 66 }
67 Expect.fail('Could not find the process_test program.'); 67 Expect.fail('Could not find the process_test program.');
68 } 68 }
69 69
70 void main() { 70 void main() {
71 int timeout = 1; 71 int timeout = 1;
72 new RunningProcess(MakeTestCase("PassTest", [PASS]), timeout).start(); 72 new RunningProcess(MakeTestCase("PassTest", [PASS]), timeout).start();
73 new RunningProcess(MakeTestCase("FailTest", [FAIL]), timeout).start(); 73 new RunningProcess(MakeTestCase("FailTest", [FAIL]), timeout).start();
74 new RunningProcess(MakeTestCase("TimeoutTest", [TIMEOUT]), timeout).start(); 74 new RunningProcess(MakeTestCase("TimeoutTest", [TIMEOUT]), timeout).start();
75 75
76 new RunningProcess(new TestCase(getProcessTestFileName(), 76 new RunningProcess(new TestCase("CrashTest", getProcessTestFileName(),
Mads Ager (google) 2011/11/08 14:58:21 Ditto.
77 const ["0", "0", "1", "1"], 77 const ["0", "0", "1", "1"],
78 TestController.processCompletedTest, 78 TestController.processCompletedTest,
79 new Set<String>.from([CRASH])), 79 new Set<String>.from([CRASH])),
80 timeout).start(); 80 timeout).start();
81 Expect.equals(4, TestController.numTests); 81 Expect.equals(4, TestController.numTests);
82 // Throw must be from body of start() function for this test to work. 82 // Throw must be from body of start() function for this test to work.
83 Expect.throws( 83 Expect.throws(
84 new RunningProcess(MakeTestCase("PassTest", [SKIP]), timeout).start); 84 new RunningProcess(MakeTestCase("PassTest", [SKIP]), timeout).start);
85 } 85 }
86 86
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698