OLD | NEW |
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 Loading... |
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, |
| 48 getDartShellFileName(), |
48 <String>["--ignore-unrecognized-flags", | 49 <String>["--ignore-unrecognized-flags", |
49 "--enable_type_checks", | 50 "--enable_type_checks", |
50 test_path], | 51 test_path], |
51 TestController.processCompletedTest, | 52 TestController.processCompletedTest, |
52 new Set<String>.from(expectations)); | 53 new Set<String>.from(expectations)); |
53 } | 54 } |
54 | 55 |
55 String getProcessTestFileName() { | 56 String getProcessTestFileName() { |
56 var names = ['out/Release_ia32/process_test', | 57 var names = ['out/Release_ia32/process_test', |
57 'out/Debug_ia32/process_test', | 58 'out/Debug_ia32/process_test', |
58 'xcodebuild/Release_ia32/process_test', | 59 'xcodebuild/Release_ia32/process_test', |
59 'xcodebuild/Debug_ia32/process_test', | 60 'xcodebuild/Debug_ia32/process_test', |
60 'Release_ia32/process_test.exe', | 61 'Release_ia32/process_test.exe', |
61 'Debug_ia32/process_test.exe']; | 62 'Debug_ia32/process_test.exe']; |
62 for (var name in names) { | 63 for (var name in names) { |
63 if (new File(name).existsSync()) { | 64 if (new File(name).existsSync()) { |
64 return name; | 65 return name; |
65 } | 66 } |
66 } | 67 } |
67 Expect.fail('Could not find the process_test program.'); | 68 Expect.fail('Could not find the process_test program.'); |
68 } | 69 } |
69 | 70 |
70 void main() { | 71 void main() { |
71 int timeout = 1; | 72 int timeout = 1; |
72 new RunningProcess(MakeTestCase("PassTest", [PASS]), timeout).start(); | 73 new RunningProcess(MakeTestCase("PassTest", [PASS]), timeout).start(); |
73 new RunningProcess(MakeTestCase("FailTest", [FAIL]), timeout).start(); | 74 new RunningProcess(MakeTestCase("FailTest", [FAIL]), timeout).start(); |
74 new RunningProcess(MakeTestCase("TimeoutTest", [TIMEOUT]), timeout).start(); | 75 new RunningProcess(MakeTestCase("TimeoutTest", [TIMEOUT]), timeout).start(); |
75 | 76 |
76 new RunningProcess(new TestCase(getProcessTestFileName(), | 77 new RunningProcess(new TestCase("CrashTest", |
| 78 getProcessTestFileName(), |
77 const ["0", "0", "1", "1"], | 79 const ["0", "0", "1", "1"], |
78 TestController.processCompletedTest, | 80 TestController.processCompletedTest, |
79 new Set<String>.from([CRASH])), | 81 new Set<String>.from([CRASH])), |
80 timeout).start(); | 82 timeout).start(); |
81 Expect.equals(4, TestController.numTests); | 83 Expect.equals(4, TestController.numTests); |
82 // Throw must be from body of start() function for this test to work. | 84 // Throw must be from body of start() function for this test to work. |
83 Expect.throws( | 85 Expect.throws( |
84 new RunningProcess(MakeTestCase("PassTest", [SKIP]), timeout).start); | 86 new RunningProcess(MakeTestCase("PassTest", [SKIP]), timeout).start); |
85 } | 87 } |
86 | 88 |
OLD | NEW |