Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Side by Side Diff: dart/tests/compiler/dart2js/resolver_test.dart

Issue 11788016: Update dart2js unit tests to new library API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: No need to implement Iterable Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 import 'dart:uri'; 5 import 'dart:uri';
6 6
7 import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart" 7 import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart"
8 hide TreeElementMapping, TreeElements, SourceString; 8 hide TreeElementMapping, TreeElements, SourceString;
9 import "../../../sdk/lib/_internal/compiler/implementation/resolution/resolution .dart"; 9 import "../../../sdk/lib/_internal/compiler/implementation/resolution/resolution .dart";
10 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t"; 10 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t";
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 testToString(); 77 testToString();
78 testIndexedOperator(); 78 testIndexedOperator();
79 testIncrementsAndDecrements(); 79 testIncrementsAndDecrements();
80 } 80 }
81 81
82 testTypeVariables() { 82 testTypeVariables() {
83 matchResolvedTypes(visitor, text, name, expectedElements) { 83 matchResolvedTypes(visitor, text, name, expectedElements) {
84 VariableDefinitions definition = parseStatement(text); 84 VariableDefinitions definition = parseStatement(text);
85 visitor.visit(definition.type); 85 visitor.visit(definition.type);
86 InterfaceType type = visitor.mapping.getType(definition.type); 86 InterfaceType type = visitor.mapping.getType(definition.type);
87 Expect.equals(definition.type.typeArguments.length(), 87 Expect.equals(definition.type.typeArguments.slowLength(),
88 length(type.typeArguments)); 88 length(type.typeArguments));
89 int index = 0; 89 int index = 0;
90 Link<DartType> arguments = type.typeArguments; 90 Link<DartType> arguments = type.typeArguments;
91 while (!arguments.isEmpty) { 91 while (!arguments.isEmpty) {
92 Expect.equals(true, index < expectedElements.length); 92 Expect.equals(true, index < expectedElements.length);
93 Expect.equals(expectedElements[index], arguments.head.element); 93 Expect.equals(expectedElements[index], arguments.head.element);
94 index++; 94 index++;
95 arguments = arguments.tail; 95 arguments = arguments.tail;
96 } 96 }
97 Expect.equals(index, expectedElements.length); 97 Expect.equals(index, expectedElements.length);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 testLocalsTwo() { 225 testLocalsTwo() {
226 MockCompiler compiler = new MockCompiler(); 226 MockCompiler compiler = new MockCompiler();
227 ResolverVisitor visitor = compiler.resolverVisitor(); 227 ResolverVisitor visitor = compiler.resolverVisitor();
228 Node tree = parseStatement("if (true) { var a = 1; var b = 2; }"); 228 Node tree = parseStatement("if (true) { var a = 1; var b = 2; }");
229 Element element = visitor.visit(tree); 229 Element element = visitor.visit(tree);
230 Expect.equals(null, element); 230 Expect.equals(null, element);
231 MethodScope scope = visitor.scope; 231 MethodScope scope = visitor.scope;
232 Expect.equals(0, scope.elements.length); 232 Expect.equals(0, scope.elements.length);
233 Expect.equals(2, map(visitor).length); 233 Expect.equals(2, map(visitor).length);
234 234
235 List<Element> elements = map(visitor).values; 235 List<Element> elements = new List<Element>.from(map(visitor).values);
236 Expect.notEquals(elements[0], elements[1]); 236 Expect.notEquals(elements[0], elements[1]);
237 } 237 }
238 238
239 testLocalsThree() { 239 testLocalsThree() {
240 MockCompiler compiler = new MockCompiler(); 240 MockCompiler compiler = new MockCompiler();
241 ResolverVisitor visitor = compiler.resolverVisitor(); 241 ResolverVisitor visitor = compiler.resolverVisitor();
242 Node tree = parseStatement("{ var a = 1; if (true) { a; } }"); 242 Node tree = parseStatement("{ var a = 1; if (true) { a; } }");
243 Element element = visitor.visit(tree); 243 Element element = visitor.visit(tree);
244 Expect.equals(null, element); 244 Expect.equals(null, element);
245 MethodScope scope = visitor.scope; 245 MethodScope scope = visitor.scope;
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 var d = new D(); 838 var d = new D();
839 --d; 839 --d;
840 }"""; 840 }""";
841 final compiler = compileScript(script); 841 final compiler = compileScript(script);
842 842
843 checkMemberResolved(compiler, 'A', operatorName('+', false)); 843 checkMemberResolved(compiler, 'A', operatorName('+', false));
844 checkMemberResolved(compiler, 'B', operatorName('+', false)); 844 checkMemberResolved(compiler, 'B', operatorName('+', false));
845 checkMemberResolved(compiler, 'C', operatorName('-', false)); 845 checkMemberResolved(compiler, 'C', operatorName('-', false));
846 checkMemberResolved(compiler, 'D', operatorName('-', false)); 846 checkMemberResolved(compiler, 'D', operatorName('-', false));
847 } 847 }
OLDNEW
« no previous file with comments | « dart/tests/compiler/dart2js/mirrors_test.dart ('k') | dart/tests/compiler/dart2js/value_range_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698