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

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

Issue 27510003: Scanner for UTF-8 byte arrays (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fixes compiler tests Created 7 years, 2 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 'package:expect/expect.dart'; 5 import 'package:expect/expect.dart';
6 import "package:async_helper/async_helper.dart"; 6 import "package:async_helper/async_helper.dart";
7 import 'compiler_helper.dart'; 7 import 'compiler_helper.dart';
8 import 'parser_helper.dart'; 8 import 'parser_helper.dart';
9 9
10 const String TEST = """ 10 const String TEST = """
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 void main() { 64 void main() {
65 Uri uri = new Uri(scheme: 'source'); 65 Uri uri = new Uri(scheme: 'source');
66 var compiler = compilerFor(TEST, uri); 66 var compiler = compilerFor(TEST, uri);
67 asyncTest(() => compiler.runCompiler(uri).then((_) { 67 asyncTest(() => compiler.runCompiler(uri).then((_) {
68 var typesTask = compiler.typesTask; 68 var typesTask = compiler.typesTask;
69 var typesInferrer = typesTask.typesInferrer; 69 var typesInferrer = typesTask.typesInferrer;
70 70
71 checkReturnInClass(String className, String methodName, type) { 71 checkReturnInClass(String className, String methodName, type) {
72 var cls = findElement(compiler, className); 72 var cls = findElement(compiler, className);
73 var element = cls.lookupLocalMember(buildSourceString(methodName)); 73 var element = cls.lookupLocalMember(methodName);
74 Expect.equals(type, 74 Expect.equals(type,
75 typesInferrer.getReturnTypeOfElement(element).simplify(compiler), 75 typesInferrer.getReturnTypeOfElement(element).simplify(compiler),
76 methodName); 76 methodName);
77 } 77 }
78 78
79 var subclassOfInterceptor = 79 var subclassOfInterceptor =
80 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'); 80 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
81 81
82 checkReturnInClass('A', 'returnNum1', typesTask.numType); 82 checkReturnInClass('A', 'returnNum1', typesTask.numType);
83 checkReturnInClass('A', 'returnNum2', typesTask.numType); 83 checkReturnInClass('A', 'returnNum2', typesTask.numType);
84 checkReturnInClass('A', 'returnNum3', typesTask.numType); 84 checkReturnInClass('A', 'returnNum3', typesTask.numType);
85 checkReturnInClass('A', 'returnNum4', typesTask.numType); 85 checkReturnInClass('A', 'returnNum4', typesTask.numType);
86 checkReturnInClass('A', 'returnEmpty1', const TypeMask.nonNullEmpty()); 86 checkReturnInClass('A', 'returnEmpty1', const TypeMask.nonNullEmpty());
87 checkReturnInClass('A', 'returnEmpty2', const TypeMask.nonNullEmpty()); 87 checkReturnInClass('A', 'returnEmpty2', const TypeMask.nonNullEmpty());
88 checkReturnInClass('A', 'returnDynamic1', subclassOfInterceptor); 88 checkReturnInClass('A', 'returnDynamic1', subclassOfInterceptor);
89 checkReturnInClass('A', 'returnDynamic2', subclassOfInterceptor); 89 checkReturnInClass('A', 'returnDynamic2', subclassOfInterceptor);
90 checkReturnInClass('A', 'returnEmpty3', const TypeMask.nonNullEmpty()); 90 checkReturnInClass('A', 'returnEmpty3', const TypeMask.nonNullEmpty());
91 91
92 checkReturnInClass('B', 'returnString1', typesTask.stringType); 92 checkReturnInClass('B', 'returnString1', typesTask.stringType);
93 checkReturnInClass('B', 'returnString2', typesTask.stringType); 93 checkReturnInClass('B', 'returnString2', typesTask.stringType);
94 checkReturnInClass('B', 'returnDynamic1', const TypeMask.nonNullEmpty()); 94 checkReturnInClass('B', 'returnDynamic1', const TypeMask.nonNullEmpty());
95 checkReturnInClass('B', 'returnDynamic2', const TypeMask.nonNullEmpty()); 95 checkReturnInClass('B', 'returnDynamic2', const TypeMask.nonNullEmpty());
96 checkReturnInClass('B', 'returnDynamic3', const TypeMask.nonNullEmpty()); 96 checkReturnInClass('B', 'returnDynamic3', const TypeMask.nonNullEmpty());
97 checkReturnInClass('B', 'returnDynamic4', const TypeMask.nonNullEmpty()); 97 checkReturnInClass('B', 'returnDynamic4', const TypeMask.nonNullEmpty());
98 })); 98 }));
99 } 99 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698