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.dart.compiler.CompilerTestCase; | 7 import com.google.dart.compiler.CompilerTestCase; |
8 import com.google.dart.compiler.ast.DartDirective; | 8 import com.google.dart.compiler.ast.DartDirective; |
9 import com.google.dart.compiler.ast.DartImportDirective; | 9 import com.google.dart.compiler.ast.DartImportDirective; |
10 import com.google.dart.compiler.ast.DartLibraryDirective; | 10 import com.google.dart.compiler.ast.DartLibraryDirective; |
11 import com.google.dart.compiler.ast.DartResourceDirective; | 11 import com.google.dart.compiler.ast.DartResourceDirective; |
12 import com.google.dart.compiler.ast.DartSourceDirective; | 12 import com.google.dart.compiler.ast.DartSourceDirective; |
13 import com.google.dart.compiler.ast.DartUnit; | 13 import com.google.dart.compiler.ast.DartUnit; |
14 | 14 |
15 import java.net.URL; | 15 import java.net.URL; |
16 import java.util.HashSet; | |
17 import java.util.Iterator; | 16 import java.util.Iterator; |
18 import java.util.Set; | |
19 | 17 |
20 /** | 18 /** |
21 * Tests for the parser, which simply assert that valid source units parse | 19 * Tests for the parser, which simply assert that valid source units parse |
22 * correctly. All tests invoking {@code parseUnit} are designed such that | 20 * correctly. All tests invoking {@code parseUnit} are designed such that |
23 * they will throw an exception if anything goes wrong in the parser. | 21 * they will throw an exception if anything goes wrong in the parser. |
24 */ | 22 */ |
25 public abstract class AbstractParserTest extends CompilerTestCase { | 23 public abstract class AbstractParserTest extends CompilerTestCase { |
26 | 24 |
27 public void testClasses() { | 25 public void testClasses() { |
28 parseUnit("ClassesInterfaces.dart"); | 26 parseUnit("ClassesInterfaces.dart"); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 for (int i = 0; i < 50; ++i) { | 152 for (int i = 0; i < 50; ++i) { |
155 out.append(source); | 153 out.append(source); |
156 } | 154 } |
157 } | 155 } |
158 String megaSource = out.toString(); | 156 String megaSource = out.toString(); |
159 long start = System.currentTimeMillis(); | 157 long start = System.currentTimeMillis(); |
160 parseUnit("Mega.dart", megaSource); | 158 parseUnit("Mega.dart", megaSource); |
161 System.out.format("%s ms for '%s.%s()'%n", System.currentTimeMillis() - star t, | 159 System.out.format("%s ms for '%s.%s()'%n", System.currentTimeMillis() - star t, |
162 getClass().getName(), getName()); | 160 getClass().getName(), getName()); |
163 } | 161 } |
164 | |
165 @Override | |
166 protected DartParser makeParser(ParserContext context) { | |
167 Set<String> prefixes = new HashSet<String>(); | |
168 prefixes.add("prefix"); | |
169 return new DartParser(context, prefixes, false); | |
170 } | |
171 } | 162 } |
OLD | NEW |