Chromium Code Reviews| Index: compiler/javatests/com/google/dart/compiler/CompilerTestCase.java |
| diff --git a/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java b/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java |
| index 2ad25036ce06f5ac07732dcc86a5953f7c08add2..bd889915085607a2e8d2751fb19afd37a6118bba 100644 |
| --- a/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java |
| +++ b/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java |
| @@ -28,6 +28,7 @@ import java.io.IOException; |
| import java.io.InputStreamReader; |
| import java.io.Reader; |
| import java.net.URI; |
| +import java.net.URISyntaxException; |
| import java.net.URL; |
| import java.util.List; |
| import java.util.Map; |
| @@ -249,6 +250,25 @@ public abstract class CompilerTestCase extends TestCase { |
| listener.checkAllErrorsReported(); |
| return unit; |
| } |
| + |
| + protected DartUnit parseUnitAsSystemLibrary (final String srcName, String sourceCode, |
| + Object... errors) { |
| + DartSourceTest src = new DartSourceTest(srcName, sourceCode, null) { |
| + @Override |
| + public URI getUri() { |
| + try { |
| + return new URI("dart:core/" + srcName); |
|
scheglov
2012/04/01 18:52:52
May be URI.create(String) and remove try/catch?
|
| + } catch (URISyntaxException e) { |
| + throw new RuntimeException(e); |
| + } |
| + } |
| + }; |
| + DartCompilerListenerTest listener = new DartCompilerListenerTest(srcName, errors); |
| + ParserContext context = makeParserContext(src, sourceCode, listener); |
| + DartUnit unit = makeParser(context).parseUnit(src); |
| + listener.checkAllErrorsReported(); |
| + return unit; |
| + } |
| /** |