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

Side by Side Diff: pkg/analyzer2dart/test/end2end_test.dart

Issue 661593004: Support local variables in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove blank lines. Created 6 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) 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 /// End-to-end test of the analyzer2dart compiler. 5 /// End-to-end test of the analyzer2dart compiler.
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'mock_sdk.dart'; 9 import 'mock_sdk.dart';
10 import 'package:analyzer/file_system/memory_file_system.dart'; 10 import 'package:analyzer/file_system/memory_file_system.dart';
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 '''); 169 ''');
170 }); 170 });
171 171
172 test('Top level field access', () { 172 test('Top level field access', () {
173 checkResult(''' 173 checkResult('''
174 main(args) { 174 main(args) {
175 return deprecated; 175 return deprecated;
176 } 176 }
177 '''); 177 ''');
178 }); 178 });
179
180 test('Local variables', () {
181 checkResult('''
182 main() {
183 var a;
184 return a;
185 }
186 ''', '''
187 main() {}
188 ''');
189
190 checkResult('''
191 main() {
192 var a = 0;
193 return a;
194 }
195 ''', '''
196 main() {
197 return 0;
198 }
199 ''');
200 });
179 } 201 }
180 202
181 checkResult(String input, [String expectedOutput]) { 203 checkResult(String input, [String expectedOutput]) {
182 if (expectedOutput == null) { 204 if (expectedOutput == null) {
183 expectedOutput = input; 205 expectedOutput = input;
184 } 206 }
185 207
186 CollectingOutputProvider outputProvider = new CollectingOutputProvider(); 208 CollectingOutputProvider outputProvider = new CollectingOutputProvider();
187 MemoryResourceProvider provider = new MemoryResourceProvider(); 209 MemoryResourceProvider provider = new MemoryResourceProvider();
188 DartSdk sdk = new MockSdk(); 210 DartSdk sdk = new MockSdk();
(...skipping 24 matching lines...) Expand all
213 sb.write(text); 235 sb.write(text);
214 } 236 }
215 237
216 void addError(errorEvent, [StackTrace stackTrace]) {} 238 void addError(errorEvent, [StackTrace stackTrace]) {}
217 239
218 void close() {} 240 void close() {}
219 241
220 String get text => sb.toString(); 242 String get text => sb.toString();
221 } 243 }
222 244
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698