| 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 // TODO(jmesserly): this was factored out of | 5 // TODO(jmesserly): this was factored out of |
| 6 // dart-lang/sdk/tools/testing/dart/multitest.dart | 6 // dart-lang/sdk/tools/testing/dart/multitest.dart |
| 7 library dev_compiler.test.tools.multitest; | 7 library dev_compiler.test.tools.multitest; |
| 8 | 8 |
| 9 final validMultitestOutcomes = new Set<String>.from([ | 9 final validMultitestOutcomes = new Set<String>.from([ |
| 10 'ok', | 10 'ok', |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // | 66 // |
| 67 // Note that it is possible to indicate more than one acceptable outcome | 67 // Note that it is possible to indicate more than one acceptable outcome |
| 68 // in the case of dynamic and static type warnings | 68 // in the case of dynamic and static type warnings |
| 69 // aaa | 69 // aaa |
| 70 // ddd /// 07: static type warning, dynamic type error | 70 // ddd /// 07: static type warning, dynamic type error |
| 71 // fff | 71 // fff |
| 72 | 72 |
| 73 void extractTestsFromMultitest(String filePath, String contents, | 73 void extractTestsFromMultitest(String filePath, String contents, |
| 74 Map<String, String> tests, Map<String, Set<String>> outcomes) { | 74 Map<String, String> tests, Map<String, Set<String>> outcomes) { |
| 75 int first_newline = contents.indexOf('\n'); | 75 int first_newline = contents.indexOf('\n'); |
| 76 final String line_separator = (first_newline == 0 || | 76 final String line_separator = |
| 77 contents[first_newline - 1] != '\r') ? '\n' : '\r\n'; | 77 (first_newline == 0 || contents[first_newline - 1] != '\r') |
| 78 ? '\n' |
| 79 : '\r\n'; |
| 78 List<String> lines = contents.split(line_separator); | 80 List<String> lines = contents.split(line_separator); |
| 79 if (lines.last == '') lines.removeLast(); | 81 if (lines.last == '') lines.removeLast(); |
| 80 contents = null; | 82 contents = null; |
| 81 | 83 |
| 82 // Create the set of multitests, which will have a new test added each | 84 // Create the set of multitests, which will have a new test added each |
| 83 // time we see a multitest line with a new key. | 85 // time we see a multitest line with a new key. |
| 84 Map<String, List<String>> testsAsLines = new Map<String, List<String>>(); | 86 Map<String, List<String>> testsAsLines = new Map<String, List<String>>(); |
| 85 | 87 |
| 86 // Add the default case with key "none". | 88 // Add the default case with key "none". |
| 87 testsAsLines['none'] = new List<String>(); | 89 testsAsLines['none'] = new List<String>(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 165 } |
| 164 | 166 |
| 165 var annotation = new _Annotation(); | 167 var annotation = new _Annotation(); |
| 166 annotation.key = parts[0]; | 168 annotation.key = parts[0]; |
| 167 annotation.rest = parts[1]; | 169 annotation.rest = parts[1]; |
| 168 annotation.outcomesList = | 170 annotation.outcomesList = |
| 169 annotation.rest.split(',').map((s) => s.trim()).toList(); | 171 annotation.rest.split(',').map((s) => s.trim()).toList(); |
| 170 return annotation; | 172 return annotation; |
| 171 } | 173 } |
| 172 } | 174 } |
| OLD | NEW |