| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 ++numCompletedTests; | 32 ++numCompletedTests; |
| 33 print("$numCompletedTests/$numTests"); | 33 print("$numCompletedTests/$numTests"); |
| 34 if (numCompletedTests == numTests) { | 34 if (numCompletedTests == numTests) { |
| 35 print("TestRunnerTest.dart PASSED"); | 35 print("TestRunnerTest.dart PASSED"); |
| 36 } | 36 } |
| 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"; |
| 42 // Working directory may be dart/runtime rather than dart. |
| 43 if (!new File(test_path).existsSync()) { |
| 44 test_path = "../tests/standalone/src/${testName}.dart"; |
| 45 } |
| 46 |
| 41 return new TestCase(getDartShellFileName(), <String>[ | 47 return new TestCase(getDartShellFileName(), <String>[ |
| 42 "--ignore-unrecognized-flags", | 48 "--ignore-unrecognized-flags", |
| 43 "--enable_type_checks", | 49 "--enable_type_checks", |
| 44 "tests/standalone/src/${testName}.dart"], | 50 "tests/standalone/src/${testName}.dart"], |
| 45 TestController.processCompletedTest, | 51 TestController.processCompletedTest, |
| 46 new Set<String>.from(expectations)); | 52 new Set<String>.from(expectations)); |
| 47 } | 53 } |
| 48 | 54 |
| 49 String getProcessTestFileName() { | 55 String getProcessTestFileName() { |
| 50 var names = ['out/Release_ia32/process_test', | 56 var names = ['out/Release_ia32/process_test', |
| 51 'out/Debug_ia32/process_test', | 57 'out/Debug_ia32/process_test', |
| 52 'xcodebuild/Release_ia32/process_test', | 58 'xcodebuild/Release_ia32/process_test', |
| 53 'xcodebuild/Debug_ia32/process_test', | 59 'xcodebuild/Debug_ia32/process_test', |
| 54 'Release_ia32/process_test.exe', | 60 'Release_ia32/process_test.exe', |
| 55 'Debug_ia32/process_test.exe']; | 61 'Debug_ia32/process_test.exe']; |
| 56 for (var name in names) { | 62 for (var name in names) { |
| 57 if (new File(name).existsSync()) { | 63 if (new File(name).existsSync()) { |
| 58 return name; | 64 return name; |
| 59 } | 65 } |
| 60 } | 66 } |
| 61 Expect.fail('Could not find the process_test program.'); | 67 Expect.fail('Could not find the process_test program.'); |
| 62 } | 68 } |
| 63 | 69 |
| 64 void main() { | 70 void main() { |
| 65 new RunningProcess(MakeTestCase("PassTest", [PASS]), 30).start(); | 71 new RunningProcess(MakeTestCase("PassTest", [PASS]), 10).start(); |
| 66 new RunningProcess(MakeTestCase("FailTest", [FAIL]), 30).start(); | 72 new RunningProcess(MakeTestCase("FailTest", [FAIL]), 10).start(); |
| 67 new RunningProcess(MakeTestCase("TimeoutTest", [TIMEOUT]), 30).start(); | 73 new RunningProcess(MakeTestCase("TimeoutTest", [TIMEOUT]), 10).start(); |
| 68 | 74 |
| 69 new RunningProcess(new TestCase(getProcessTestFileName(), | 75 new RunningProcess(new TestCase(getProcessTestFileName(), |
| 70 const ["0", "0", "1", "1"], | 76 const ["0", "0", "1", "1"], |
| 71 TestController.processCompletedTest, | 77 TestController.processCompletedTest, |
| 72 new Set<String>.from([CRASH])), | 78 new Set<String>.from([CRASH])), |
| 73 30).start(); | 79 10).start(); |
| 74 Expect.equals(4, TestController.numTests); | 80 Expect.equals(4, TestController.numTests); |
| 75 // Throw must be from body of start() function for this test to work. | 81 // Throw must be from body of start() function for this test to work. |
| 76 Expect.throws( | 82 Expect.throws( |
| 77 new RunningProcess(MakeTestCase("PassTest", [SKIP]), 30).start); | 83 new RunningProcess(MakeTestCase("PassTest", [SKIP]), 10).start); |
| 78 } | 84 } |
| 79 | 85 |
| OLD | NEW |