Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #import("dart:io"); | 5 #import("dart:io"); |
| 6 #import("../../../../tools/testing/dart/test_runner.dart"); | 6 #import("../../../../tools/testing/dart/test_runner.dart"); |
| 7 #import("../../../../tools/testing/dart/status_file_parser.dart"); | 7 #import("../../../../tools/testing/dart/status_file_parser.dart"); |
| 8 #source("ProcessTestUtil.dart"); | 8 #source("ProcessTestUtil.dart"); |
| 9 | 9 |
| 10 class TestController { | 10 class TestController { |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 | 36 |
| 37 | 37 |
| 38 TestCase MakeTestCase(String testName, List<String> expectations) { | 38 TestCase MakeTestCase(String testName, List<String> expectations) { |
| 39 String test_path = "tests/standalone/src/${testName}.dart"; | 39 String test_path = "tests/standalone/src/${testName}.dart"; |
| 40 // Working directory may be dart/runtime rather than dart. | 40 // Working directory may be dart/runtime rather than dart. |
| 41 if (!new File(test_path).existsSync()) { | 41 if (!new File(test_path).existsSync()) { |
| 42 test_path = "../tests/standalone/src/${testName}.dart"; | 42 test_path = "../tests/standalone/src/${testName}.dart"; |
| 43 } | 43 } |
| 44 | 44 |
| 45 var configuration = { 'timeout': 2, | 45 var configuration = { 'timeout': 2, |
| 46 'special-command': '' }; | 46 'special-command': '', |
| 47 'verbose': false }; | |
| 47 return new TestCase(testName, | 48 return new TestCase(testName, |
| 48 [new Command(getDartFileName(), | 49 [new Command(getDartFileName(), |
| 49 <String>["--ignore-unrecognized-flags", | 50 <String>["--ignore-unrecognized-flags", |
| 50 "--enable_type_checks", | 51 "--enable_type_checks", |
| 51 test_path])], | 52 test_path])], |
| 52 configuration, | 53 configuration, |
| 53 TestController.processCompletedTest, | 54 TestController.processCompletedTest, |
| 54 new Set<String>.from(expectations)); | 55 new Set<String>.from(expectations)); |
| 55 } | 56 } |
| 56 | 57 |
| 57 | 58 |
| 58 void main() { | 59 void main() { |
| 59 var configuration = { 'timeout': 2, | |
| 60 'special-command': '' }; | |
| 61 new RunningProcess(MakeTestCase("PassTest", [PASS])).start(); | 60 new RunningProcess(MakeTestCase("PassTest", [PASS])).start(); |
| 62 new RunningProcess(MakeTestCase("FailTest", [FAIL])).start(); | 61 new RunningProcess(MakeTestCase("FailTest", [FAIL])).start(); |
| 63 new RunningProcess(MakeTestCase("TimeoutTest", [TIMEOUT])).start(); | 62 new RunningProcess(MakeTestCase("TimeoutTest", [TIMEOUT])).start(); |
| 64 | 63 |
| 64 var configuration = { 'timeout': 10, | |
|
Mads Ager (google)
2012/04/19 10:15:12
I wonder if we can invoke the options parser to ge
| |
| 65 'special-command': '', | |
| 66 'verbose': false }; | |
| 65 new RunningProcess(new TestCase("CrashTest", | 67 new RunningProcess(new TestCase("CrashTest", |
| 66 [new Command(getProcessTestFileName(), | 68 [new Command(getProcessTestFileName(), |
| 67 const ["0", "0", "1", "1"])], | 69 const ["0", "0", "1", "1"])], |
| 68 configuration, | 70 configuration, |
| 69 TestController.processCompletedTest, | 71 TestController.processCompletedTest, |
| 70 new Set<String>.from([CRASH]))).start(); | 72 new Set<String>.from([CRASH]))).start(); |
| 71 Expect.equals(4, TestController.numTests); | 73 Expect.equals(4, TestController.numTests); |
| 72 // Throw must be from body of start() function for this test to work. | 74 // Throw must be from body of start() function for this test to work. |
| 73 Expect.throws(new RunningProcess(MakeTestCase("PassTest", [SKIP])).start); | 75 Expect.throws(new RunningProcess(MakeTestCase("PassTest", [SKIP])).start); |
| 74 } | 76 } |
| OLD | NEW |