| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 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 | 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 #library("stub_generator_test_config"); | 5 #library("stub_generator_test_config"); |
| 6 | 6 |
| 7 #import("../../tools/testing/dart/test_suite.dart"); | 7 #import("../../tools/testing/dart/test_suite.dart"); |
| 8 | 8 |
| 9 class StubGeneratorTestSuite extends StandardTestSuite { | 9 class StubGeneratorTestSuite extends StandardTestSuite { |
| 10 String dartcPath; | 10 String dartcPath; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 stubsOutFile.createSync(); | 105 stubsOutFile.createSync(); |
| 106 String stubsPath = stubsOutFile.fullPathSync(); | 106 String stubsPath = stubsOutFile.fullPathSync(); |
| 107 List<String> args = [filename, | 107 List<String> args = [filename, |
| 108 '-noincremental', | 108 '-noincremental', |
| 109 '-out', temp.path, | 109 '-out', temp.path, |
| 110 '-isolate-stub-out', stubsPath, | 110 '-isolate-stub-out', stubsPath, |
| 111 '-generate-isolate-stubs', classes ]; | 111 '-generate-isolate-stubs', classes ]; |
| 112 if (configuration['verbose']) { | 112 if (configuration['verbose']) { |
| 113 print("# $dartcPath ${Strings.join(args, ' ')}"); | 113 print("# $dartcPath ${Strings.join(args, ' ')}"); |
| 114 } | 114 } |
| 115 Process dartcProcess = new Process(dartcPath, args); | 115 Process dartcProcess = new Process.start(dartcPath, args); |
| 116 dartcProcess.exitHandler = (int exitCode) { | 116 dartcProcess.exitHandler = (int exitCode) { |
| 117 combineFiles(filename, stubsPath, onGenerated); | 117 combineFiles(filename, stubsPath, onGenerated); |
| 118 }; | 118 }; |
| 119 dartcProcess.start(); | |
| 120 } | 119 } |
| 121 | 120 |
| 122 void processFile(String filename) { | 121 void processFile(String filename) { |
| 123 // Only run the tests that match the pattern. | 122 // Only run the tests that match the pattern. |
| 124 RegExp pattern = configuration['selectors'][suiteName]; | 123 RegExp pattern = configuration['selectors'][suiteName]; |
| 125 if (!pattern.hasMatch(filename)) return; | 124 if (!pattern.hasMatch(filename)) return; |
| 126 var optionsFromFile = optionsFromFile(filename); | 125 var optionsFromFile = optionsFromFile(filename); |
| 127 Function createTestCase = makeTestCaseCreator(optionsFromFile); | 126 Function createTestCase = makeTestCaseCreator(optionsFromFile); |
| 128 | 127 |
| 129 if (filename.endsWith("-generatedTest.dart")) { | 128 if (filename.endsWith("-generatedTest.dart")) { |
| 130 if (dartcPath == null) { | 129 if (dartcPath == null) { |
| 131 createTestCase(filename, optionsFromFile['isNegative']); | 130 createTestCase(filename, optionsFromFile['isNegative']); |
| 132 } | 131 } |
| 133 } else if (filename.endsWith("Test.dart")) { | 132 } else if (filename.endsWith("Test.dart")) { |
| 134 if (dartcPath != null) { | 133 if (dartcPath != null) { |
| 135 String isolateStubsOptions = optionsFromFile['isolateStubs']; | 134 String isolateStubsOptions = optionsFromFile['isolateStubs']; |
| 136 List<String> splitIsolateStubsOptions = isolateStubsOptions.split(':'); | 135 List<String> splitIsolateStubsOptions = isolateStubsOptions.split(':'); |
| 137 Expect.equals(2, splitIsolateStubsOptions.length); | 136 Expect.equals(2, splitIsolateStubsOptions.length); |
| 138 String interfaceFile = splitIsolateStubsOptions[0]; | 137 String interfaceFile = splitIsolateStubsOptions[0]; |
| 139 String classes = splitIsolateStubsOptions[1]; | 138 String classes = splitIsolateStubsOptions[1]; |
| 140 generateTestCase(filename, interfaceFile, classes, (String filename) { | 139 generateTestCase(filename, interfaceFile, classes, (String filename) { |
| 141 createTestCase(filename, optionsFromFile['isNegative']); | 140 createTestCase(filename, optionsFromFile['isNegative']); |
| 142 testGeneratorDone(); | 141 testGeneratorDone(); |
| 143 }); | 142 }); |
| 144 } | 143 } |
| 145 } | 144 } |
| 146 } | 145 } |
| 147 } | 146 } |
| OLD | NEW |