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

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

Issue 10826279: Register toString dynamic invocation in the presence of string interpolation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 // Test constant folding. 4 // Test constant folding.
5 5
6 #library("compiler_helper"); 6 #library("compiler_helper");
7 7
8 #import("dart:uri"); 8 #import("dart:uri");
9 #import("../../../lib/compiler/implementation/leg.dart", prefix: "leg"); 9 #import("../../../lib/compiler/implementation/leg.dart", prefix: "leg");
10 #import("../../../lib/compiler/implementation/elements/elements.dart", prefix: " lego"); 10 #import("../../../lib/compiler/implementation/elements/elements.dart", prefix: " lego");
(...skipping 19 matching lines...) Expand all
30 return compiler; 30 return compiler;
31 } 31 }
32 32
33 String compileAll(String code) { 33 String compileAll(String code) {
34 Uri uri = new Uri.fromComponents(scheme: 'source'); 34 Uri uri = new Uri.fromComponents(scheme: 'source');
35 MockCompiler compiler = compilerFor(code, uri); 35 MockCompiler compiler = compilerFor(code, uri);
36 compiler.runCompiler(uri); 36 compiler.runCompiler(uri);
37 return compiler.assembledCode; 37 return compiler.assembledCode;
38 } 38 }
39 39
40 lego.Element findElement(var compiler, String name) {
41 var element = compiler.mainApp.find(buildSourceString(name));
42 Expect.isNotNull(element, 'Could not locate $name.');
43 return element;
44 }
45
40 String anyIdentifier = "[a-zA-Z][a-zA-Z0-9]*"; 46 String anyIdentifier = "[a-zA-Z][a-zA-Z0-9]*";
41 47
42 String getIntTypeCheck(String variable) { 48 String getIntTypeCheck(String variable) {
43 return "\\($variable !== \\($variable \\| 0\\)\\)"; 49 return "\\($variable !== \\($variable \\| 0\\)\\)";
44 } 50 }
45 51
46 String getNumberTypeCheck(String variable) { 52 String getNumberTypeCheck(String variable) {
47 return "\\(typeof $variable !== 'number'\\)"; 53 return "\\(typeof $variable !== 'number'\\)";
48 } 54 }
49 55
50 bool checkNumberOfMatches(Iterator it, int nb) { 56 bool checkNumberOfMatches(Iterator it, int nb) {
51 for (int i = 0; i < nb; i++) { 57 for (int i = 0; i < nb; i++) {
52 Expect.isTrue(it.hasNext()); 58 Expect.isTrue(it.hasNext());
53 it.next(); 59 it.next();
54 } 60 }
55 Expect.isFalse(it.hasNext()); 61 Expect.isFalse(it.hasNext());
56 } 62 }
57 63
58 void compileAndMatch(String code, String entry, RegExp regexp) { 64 void compileAndMatch(String code, String entry, RegExp regexp) {
59 String generated = compile(code, entry); 65 String generated = compile(code, entry);
60 Expect.isTrue(regexp.hasMatch(generated), 66 Expect.isTrue(regexp.hasMatch(generated),
61 '"$generated" does not match /$regexp/'); 67 '"$generated" does not match /$regexp/');
62 } 68 }
63 69
64 void compileAndDoNotMatch(String code, String entry, RegExp regexp) { 70 void compileAndDoNotMatch(String code, String entry, RegExp regexp) {
65 String generated = compile(code, entry); 71 String generated = compile(code, entry);
66 Expect.isFalse(regexp.hasMatch(generated), 72 Expect.isFalse(regexp.hasMatch(generated),
67 '"$generated" has a match in /$regexp/'); 73 '"$generated" has a match in /$regexp/');
68 } 74 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/call_site_type_inferer_test.dart ('k') | tests/compiler/dart2js/concrete_type_inference_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698