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 |
Brian Wilkerson
2012/06/25 14:24:38
nit: copyright year
scheglov
2012/06/26 19:46:34
Done.
| |
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 package com.google.dart.compiler.parser; | 5 package com.google.dart.compiler.parser; |
6 | 6 |
7 import com.google.common.collect.Sets; | |
7 import com.google.dart.compiler.DartCompilerListenerTest; | 8 import com.google.dart.compiler.DartCompilerListenerTest; |
8 import com.google.dart.compiler.DartSource; | 9 import com.google.dart.compiler.DartSource; |
9 import com.google.dart.compiler.LibrarySource; | 10 import com.google.dart.compiler.LibrarySource; |
10 import com.google.dart.compiler.ast.LibraryNode; | 11 import com.google.dart.compiler.ast.LibraryNode; |
11 import com.google.dart.compiler.ast.LibraryUnit; | 12 import com.google.dart.compiler.ast.LibraryUnit; |
12 | 13 |
13 import junit.framework.TestCase; | 14 import junit.framework.TestCase; |
14 | 15 |
15 import java.io.IOException; | |
16 import java.io.Reader; | 16 import java.io.Reader; |
17 import java.io.StringReader; | 17 import java.io.StringReader; |
18 import java.net.URI; | 18 import java.net.URI; |
19 import java.net.URISyntaxException; | 19 import java.net.URISyntaxException; |
20 | 20 |
21 /** | 21 /** |
22 * Tests for parsing library directives from a dart file. | 22 * Tests for parsing library directives from a dart file. |
23 */ | 23 */ |
24 public class LibraryParserTest extends TestCase { | 24 public class LibraryParserTest extends TestCase { |
25 | 25 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 } | 176 } |
177 return; | 177 return; |
178 } | 178 } |
179 } | 179 } |
180 fail("Missing " + ((prefix != null) ? (prefix + " : ") : "") + name); | 180 fail("Missing " + ((prefix != null) ? (prefix + " : ") : "") + name); |
181 } | 181 } |
182 | 182 |
183 private LibraryUnit parse(String text, Object... errors) { | 183 private LibraryUnit parse(String text, Object... errors) { |
184 TestLibrarySource source = new TestLibrarySource(text); | 184 TestLibrarySource source = new TestLibrarySource(text); |
185 DartCompilerListenerTest listener = new DartCompilerListenerTest(source.getN ame(), errors); | 185 DartCompilerListenerTest listener = new DartCompilerListenerTest(source.getN ame(), errors); |
186 try { | 186 LibraryUnit unit = new DartParser( |
187 LibraryUnit unit = | 187 source, |
188 DartParser.getSourceParser(source, listener).preProcessLibraryDirectives (source); | 188 text, |
189 listener.checkAllErrorsReported(); | 189 false, |
190 return unit; | 190 Sets.<String>newHashSet(), |
191 } catch (IOException ioEx) { | 191 listener, |
192 throw new AssertionError(ioEx); | 192 null).preProcessLibraryDirectives(source); |
193 } | 193 listener.checkAllErrorsReported(); |
194 return unit; | |
194 } | 195 } |
195 } | 196 } |
OLD | NEW |