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 12 matching lines...) Expand all Loading... |
23 | 23 |
24 bool get requiresCleanTemporaryDirectory() => true; | 24 bool get requiresCleanTemporaryDirectory() => true; |
25 | 25 |
26 void combineFiles(String filename, | 26 void combineFiles(String filename, |
27 String stubsFile, | 27 String stubsFile, |
28 Function onGenerated) { | 28 Function onGenerated) { |
29 File orig = new File(filename); | 29 File orig = new File(filename); |
30 File stubs = new File(stubsFile); | 30 File stubs = new File(stubsFile); |
31 Expect.isTrue(filename.endsWith(".dart")); | 31 Expect.isTrue(filename.endsWith(".dart")); |
32 String baseName = filename.substring(0, filename.length - 5); | 32 String baseName = filename.substring(0, filename.length - 5); |
33 String resultPath = '${baseName}-generatedTest.dart'; | 33 // Find place in the buildDir at the same relative level as the test. |
| 34 String resultPath = TestUtils.buildDir(configuration); |
| 35 String relativeImportPath = '../../../tests/isolate/src/TestFramework.dart'; |
| 36 if (!new File('$resultPath/$relativeImportPath').existsSync()) { |
| 37 resultPath = '$resultPath/generated_tests'; |
| 38 if (!new Directory(resultPath).existsSync()) { |
| 39 new Directory(resultPath).createSync(); |
| 40 } |
| 41 if (!new File('$resultPath/$relativeImportPath').existsSync()) { |
| 42 throw new Exception('Cannot find $relativeImportPath from $resultPath'); |
| 43 } |
| 44 } |
| 45 int testNamePos = filename.lastIndexOf('/'); |
| 46 resultPath = '$resultPath/${filename.substring(testNamePos + 1)}'; |
34 File result = new File(resultPath); | 47 File result = new File(resultPath); |
35 StringInputStream origStream = | 48 StringInputStream origStream = |
36 new StringInputStream(orig.openInputStream()); | 49 new StringInputStream(orig.openInputStream()); |
37 StringInputStream stubsStream = | 50 StringInputStream stubsStream = |
38 new StringInputStream(stubs.openInputStream()); | 51 new StringInputStream(stubs.openInputStream()); |
39 OutputStream resultStream = result.openOutputStream(); | 52 OutputStream resultStream = result.openOutputStream(); |
40 var origLine; | 53 var origLine; |
41 | 54 |
42 void writeResultLine(String line) { | 55 void writeResultLine(String line) { |
43 resultStream.write(line.charCodes()); | 56 resultStream.write(line.charCodes()); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 String interfaceFile = splitIsolateStubsOptions[0]; | 153 String interfaceFile = splitIsolateStubsOptions[0]; |
141 String classes = splitIsolateStubsOptions[1]; | 154 String classes = splitIsolateStubsOptions[1]; |
142 generateTestCase(filename, interfaceFile, classes, (String filename) { | 155 generateTestCase(filename, interfaceFile, classes, (String filename) { |
143 createTestCase(filename, optionsFromFile['isNegative']); | 156 createTestCase(filename, optionsFromFile['isNegative']); |
144 testGeneratorDone(); | 157 testGeneratorDone(); |
145 }); | 158 }); |
146 } | 159 } |
147 } | 160 } |
148 } | 161 } |
149 } | 162 } |
OLD | NEW |