| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 checkResult(''' | 428 checkResult(''' |
| 429 main(a) { | 429 main(a) { |
| 430 return a && deprecated; | 430 return a && deprecated; |
| 431 } | 431 } |
| 432 ''', ''' | 432 ''', ''' |
| 433 main(a) { | 433 main(a) { |
| 434 return a && deprecated; | 434 return a && deprecated; |
| 435 } | 435 } |
| 436 '''); | 436 '''); |
| 437 }); | 437 }); |
| 438 |
| 439 test('If statement', () { |
| 440 checkResult(''' |
| 441 main(a) { |
| 442 if (a) { |
| 443 print(0); |
| 444 } |
| 445 } |
| 446 ''', ''' |
| 447 main(a) { |
| 448 if (a) { |
| 449 print(0); |
| 450 } |
| 451 } |
| 452 '''); |
| 453 |
| 454 checkResult(''' |
| 455 main(a) { |
| 456 if (a) { |
| 457 print(0); |
| 458 } else { |
| 459 print(1); |
| 460 } |
| 461 } |
| 462 ''', ''' |
| 463 main(a) { |
| 464 a ? print(0) : print(1); |
| 465 } |
| 466 '''); |
| 467 |
| 468 checkResult(''' |
| 469 main(a) { |
| 470 if (a) { |
| 471 print(0); |
| 472 } else { |
| 473 print(1); |
| 474 print(2); |
| 475 } |
| 476 } |
| 477 ''', ''' |
| 478 main(a) { |
| 479 if (a) { |
| 480 print(0); |
| 481 } else { |
| 482 print(1); |
| 483 print(2); |
| 484 } |
| 485 } |
| 486 '''); |
| 487 |
| 488 }); |
| 438 } | 489 } |
| 439 | 490 |
| 440 checkResult(String input, [String expectedOutput]) { | 491 checkResult(String input, [String expectedOutput]) { |
| 441 if (expectedOutput == null) { | 492 if (expectedOutput == null) { |
| 442 expectedOutput = input; | 493 expectedOutput = input; |
| 443 } | 494 } |
| 444 | 495 |
| 445 CollectingOutputProvider outputProvider = new CollectingOutputProvider(); | 496 CollectingOutputProvider outputProvider = new CollectingOutputProvider(); |
| 446 MemoryResourceProvider provider = new MemoryResourceProvider(); | 497 MemoryResourceProvider provider = new MemoryResourceProvider(); |
| 447 DartSdk sdk = new MockSdk(); | 498 DartSdk sdk = new MockSdk(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 472 sb.write(text); | 523 sb.write(text); |
| 473 } | 524 } |
| 474 | 525 |
| 475 void addError(errorEvent, [StackTrace stackTrace]) {} | 526 void addError(errorEvent, [StackTrace stackTrace]) {} |
| 476 | 527 |
| 477 void close() {} | 528 void close() {} |
| 478 | 529 |
| 479 String get text => sb.toString(); | 530 String get text => sb.toString(); |
| 480 } | 531 } |
| 481 | 532 |
| OLD | NEW |