| 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 ''', ''' | 477 ''', ''' |
| 478 main(a) { | 478 main(a) { |
| 479 if (a) { | 479 if (a) { |
| 480 print(0); | 480 print(0); |
| 481 } else { | 481 } else { |
| 482 print(1); | 482 print(1); |
| 483 print(2); | 483 print(2); |
| 484 } | 484 } |
| 485 } | 485 } |
| 486 '''); | 486 '''); |
| 487 }); |
| 487 | 488 |
| 489 test('If statement', () { |
| 490 checkResult(''' |
| 491 main(a) { |
| 492 return a ? print(0) : print(1); |
| 493 } |
| 494 ''', ''' |
| 495 main(a) { |
| 496 return a ? print(0) : print(1); |
| 497 } |
| 498 '''); |
| 488 }); | 499 }); |
| 489 } | 500 } |
| 490 | 501 |
| 491 checkResult(String input, [String expectedOutput]) { | 502 checkResult(String input, [String expectedOutput]) { |
| 492 if (expectedOutput == null) { | 503 if (expectedOutput == null) { |
| 493 expectedOutput = input; | 504 expectedOutput = input; |
| 494 } | 505 } |
| 495 | 506 |
| 496 CollectingOutputProvider outputProvider = new CollectingOutputProvider(); | 507 CollectingOutputProvider outputProvider = new CollectingOutputProvider(); |
| 497 MemoryResourceProvider provider = new MemoryResourceProvider(); | 508 MemoryResourceProvider provider = new MemoryResourceProvider(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 523 sb.write(text); | 534 sb.write(text); |
| 524 } | 535 } |
| 525 | 536 |
| 526 void addError(errorEvent, [StackTrace stackTrace]) {} | 537 void addError(errorEvent, [StackTrace stackTrace]) {} |
| 527 | 538 |
| 528 void close() {} | 539 void close() {} |
| 529 | 540 |
| 530 String get text => sb.toString(); | 541 String get text => sb.toString(); |
| 531 } | 542 } |
| 532 | 543 |
| OLD | NEW |