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 library compiler_helper; | 5 library compiler_helper; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
9 | 9 |
10 import 'package:compiler/compiler.dart' as api; | 10 import 'package:compiler/compiler.dart' as api; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 analyzeAll: analyzeAll, | 102 analyzeAll: analyzeAll, |
103 analyzeOnly: analyzeOnly, | 103 analyzeOnly: analyzeOnly, |
104 coreSource: coreSource, | 104 coreSource: coreSource, |
105 disableInlining: disableInlining, | 105 disableInlining: disableInlining, |
106 enableMinification: minify, | 106 enableMinification: minify, |
107 trustTypeAnnotations: trustTypeAnnotations, | 107 trustTypeAnnotations: trustTypeAnnotations, |
108 expectedErrors: expectedErrors, | 108 expectedErrors: expectedErrors, |
109 expectedWarnings: expectedWarnings, | 109 expectedWarnings: expectedWarnings, |
110 outputProvider: outputProvider); | 110 outputProvider: outputProvider); |
111 compiler.registerSource(uri, code); | 111 compiler.registerSource(uri, code); |
112 compiler.diagnosticHandler = createHandler(compiler, code); | |
113 return compiler; | 112 return compiler; |
114 } | 113 } |
115 | 114 |
116 Future<String> compileAll(String code, | 115 Future<String> compileAll(String code, |
117 {Map<String, String> coreSource, | 116 {Map<String, String> coreSource, |
118 bool disableInlining: true, | 117 bool disableInlining: true, |
119 bool trustTypeAnnotations: false, | 118 bool trustTypeAnnotations: false, |
120 bool minify: false, | 119 bool minify: false, |
121 int expectedErrors, | 120 int expectedErrors, |
122 int expectedWarnings}) { | 121 int expectedWarnings}) { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); | 259 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); |
261 final spaceRe = new RegExp('\\s+'); | 260 final spaceRe = new RegExp('\\s+'); |
262 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); | 261 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); |
263 if (shouldMatch) { | 262 if (shouldMatch) { |
264 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); | 263 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); |
265 } else { | 264 } else { |
266 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); | 265 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); |
267 } | 266 } |
268 }); | 267 }); |
269 } | 268 } |
OLD | NEW |