| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |