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

Side by Side Diff: tests/compiler/dart2js/backend_dart/sexpr_test.dart

Issue 1004683002: Refactor IrBuilder to use SemanticVisitor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Handle local/static constants and index prefix/postfix. Created 5 years, 9 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library dart_backend.sexpr_test; 5 library dart_backend.sexpr_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:async_helper/async_helper.dart'; 9 import 'package:async_helper/async_helper.dart';
10 import 'package:compiler/src/dart2jslib.dart'; 10 import 'package:compiler/src/dart2jslib.dart';
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 Future<List<String>> testStringifier(String code, 105 Future<List<String>> testStringifier(String code,
106 Iterable<String> expectedTokens) { 106 Iterable<String> expectedTokens) {
107 return compile(code) 107 return compile(code)
108 .then((List<FunctionDefinition> functions) { 108 .then((List<FunctionDefinition> functions) {
109 List<String> sexprs = stringifyAll(functions); 109 List<String> sexprs = stringifyAll(functions);
110 String combined = sexprs.join(); 110 String combined = sexprs.join();
111 String withoutNullConstants = combined.replaceAll("Constant null", ""); 111 String withoutNullConstants = combined.replaceAll("Constant null", "");
112 Expect.isFalse(withoutNullConstants.contains("null")); 112 Expect.isFalse(withoutNullConstants.contains("null"));
113 for (String token in expectedTokens) { 113 for (String token in expectedTokens) {
114 Expect.isTrue(combined.contains(token)); 114 Expect.isTrue(combined.contains(token),
115 "'$combined' doesn't contain '$token' in test:\n$code");
115 } 116 }
116 117
117 return sexprs; 118 return sexprs;
118 }); 119 });
119 } 120 }
120 121
121 /// Checks if the generated S-expressions can be processed by the unstringifier, 122 /// Checks if the generated S-expressions can be processed by the unstringifier,
122 /// returns the resulting definitions. 123 /// returns the resulting definitions.
123 List<FunctionDefinition> testUnstringifier(List<String> sexprs) { 124 List<FunctionDefinition> testUnstringifier(List<String> sexprs) {
124 return sexprs.map((String sexpr) { 125 return sexprs.map((String sexpr) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 ]; 165 ];
165 166
166 asyncTest(() => testStringifier(CODE, tokens).then((List<String> sexprs) { 167 asyncTest(() => testStringifier(CODE, tokens).then((List<String> sexprs) {
167 final functions = testUnstringifier(sexprs); 168 final functions = testUnstringifier(sexprs);
168 169
169 // Ensure that 170 // Ensure that
170 // stringified(CODE) == stringified(unstringified(stringified(CODE))) 171 // stringified(CODE) == stringified(unstringified(stringified(CODE)))
171 Expect.listEquals(sexprs, stringifyAll(functions)); 172 Expect.listEquals(sexprs, stringifyAll(functions));
172 })); 173 }));
173 } 174 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/send_structure.dart ('k') | tests/compiler/dart2js/semantic_visitor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698