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("multitest"); | 5 #library("multitest"); |
6 | 6 |
7 // Multitests are Dart test scripts containing lines of the form | 7 // Multitests are Dart test scripts containing lines of the form |
8 // " [some dart code] /// [key]: [error type]" | 8 // " [some dart code] /// [key]: [error type]" |
9 // | 9 // |
10 // For each key in the file, a new test file is made containing all | 10 // For each key in the file, a new test file is made containing all |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 String directory = CreateMultitestDirectory(outputDir, testDir); | 129 String directory = CreateMultitestDirectory(outputDir, testDir); |
130 String pathSeparator = new Platform().pathSeparator(); | 130 String pathSeparator = new Platform().pathSeparator(); |
131 int start = filename.lastIndexOf(pathSeparator) + 1; | 131 int start = filename.lastIndexOf(pathSeparator) + 1; |
132 int end = filename.indexOf('.dart', start); | 132 int end = filename.indexOf('.dart', start); |
133 String baseFilename = filename.substring(start, end); | 133 String baseFilename = filename.substring(start, end); |
134 for (String key in tests.getKeys()) { | 134 for (String key in tests.getKeys()) { |
135 final String filename = '$directory/${baseFilename}_$key.dart'; | 135 final String filename = '$directory/${baseFilename}_$key.dart'; |
136 final File file = new File(filename); | 136 final File file = new File(filename); |
137 | 137 |
138 file.createSync(); | 138 file.createSync(); |
139 RandomAccessFile openedFile = file.openSync(writable: true); | 139 RandomAccessFile openedFile = file.openSync(FileMode.WRITE); |
140 var bytes = tests[key].charCodes(); | 140 var bytes = tests[key].charCodes(); |
141 openedFile.writeListSync(bytes, 0, bytes.length); | 141 openedFile.writeListSync(bytes, 0, bytes.length); |
142 openedFile.closeSync(); | 142 openedFile.closeSync(); |
143 var outcome = outcomes[key]; | 143 var outcome = outcomes[key]; |
144 bool enableFatalTypeErrors = outcome.contains('static type error'); | 144 bool enableFatalTypeErrors = outcome.contains('static type error'); |
145 bool isNegative = (outcome.contains('compile-time error') || | 145 bool isNegative = (outcome.contains('compile-time error') || |
146 outcome.contains('runtime error')); | 146 outcome.contains('runtime error')); |
147 bool isNegativeIfChecked = outcome.contains('dynamic type error'); | 147 bool isNegativeIfChecked = outcome.contains('dynamic type error'); |
148 doTest(filename, | 148 doTest(filename, |
149 isNegative, | 149 isNegative, |
(...skipping 13 matching lines...) Expand all Loading... |
163 var split = testDir.split('/'); | 163 var split = testDir.split('/'); |
164 var lastComponent = split.removeLast(); | 164 var lastComponent = split.removeLast(); |
165 Expect.isTrue(lastComponent == 'src'); | 165 Expect.isTrue(lastComponent == 'src'); |
166 String path = '${parentDir.path}/${split.last()}'; | 166 String path = '${parentDir.path}/${split.last()}'; |
167 Directory dir = new Directory(path); | 167 Directory dir = new Directory(path); |
168 if (!dir.existsSync()) { | 168 if (!dir.existsSync()) { |
169 dir.createSync(); | 169 dir.createSync(); |
170 } | 170 } |
171 return path; | 171 return path; |
172 } | 172 } |
OLD | NEW |