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

Side by Side Diff: pkg/analyzer/test/generated/incremental_resolver_test.dart

Issue 760933003: Finish parameters matching. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 engine.incremental_resolver_test; 5 library engine.incremental_resolver_test;
6 6
7 import 'package:analyzer/src/generated/ast.dart'; 7 import 'package:analyzer/src/generated/ast.dart';
8 import 'package:analyzer/src/generated/element.dart'; 8 import 'package:analyzer/src/generated/element.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/error.dart'; 10 import 'package:analyzer/src/generated/error.dart';
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 } 614 }
615 615
616 void test_false_functionTypeAlias_typeParameters_list_remove() { 616 void test_false_functionTypeAlias_typeParameters_list_remove() {
617 _assertCompilationUnitMatches(false, r''' 617 _assertCompilationUnitMatches(false, r'''
618 typedef F<A, B>(); 618 typedef F<A, B>();
619 ''', r''' 619 ''', r'''
620 typedef F<A>(); 620 typedef F<A>();
621 '''); 621 ''');
622 } 622 }
623 623
624 void test_false_FunctionTypedFormalParameter_parameters_list_add() {
625 _assertCompilationUnitMatches(false, r'''
626 main(int callback(int a)) {
627 }
628 ''', r'''
629 main(int callback(int a, String b)) {
630 }
631 ''');
632 }
633
634 void test_false_FunctionTypedFormalParameter_parameters_list_remove() {
635 _assertCompilationUnitMatches(false, r'''
636 main(int callback(int a, String b)) {
637 }
638 ''', r'''
639 main(int callback(int a)) {
640 }
641 ''');
642 }
643
644 void test_false_FunctionTypedFormalParameter_parameterType() {
645 _assertCompilationUnitMatches(false, r'''
646 main(int callback(int p)) {
647 }
648 ''', r'''
649 main(int callback(String p)) {
650 }
651 ''');
652 }
653
654 void test_false_FunctionTypedFormalParameter_returnType() {
655 _assertCompilationUnitMatches(false, r'''
656 main(int callback()) {
657 }
658 ''', r'''
659 main(String callback()) {
660 }
661 ''');
662 }
663
664 void test_false_FunctionTypedFormalParameter_wasSimple() {
665 _assertCompilationUnitMatches(false, r'''
666 main(int callback) {
667 }
668 ''', r'''
669 main(int callback(int a, String b)) {
670 }
671 ''');
672 }
673
624 void test_false_implementsClause_add() { 674 void test_false_implementsClause_add() {
625 _assertCompilationUnitMatches(false, r''' 675 _assertCompilationUnitMatches(false, r'''
626 class A {} 676 class A {}
627 class B {} 677 class B {}
628 ''', r''' 678 ''', r'''
629 class A {} 679 class A {}
630 class B implements A {} 680 class B implements A {}
631 '''); 681 ''');
632 } 682 }
633 683
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 _assertCompilationUnitMatches(false, r''' 838 _assertCompilationUnitMatches(false, r'''
789 library lib; 839 library lib;
790 part 'unitA.dart'; 840 part 'unitA.dart';
791 part 'unitB.dart'; 841 part 'unitB.dart';
792 ''', r''' 842 ''', r'''
793 library lib; 843 library lib;
794 part 'unitA.dart'; 844 part 'unitA.dart';
795 '''); 845 ''');
796 } 846 }
797 847
848 void test_false_SimpleFormalParameter_named_differentName() {
Brian Wilkerson 2014/11/26 20:45:31 Add tests for adding and removing default values f
scheglov 2014/11/26 20:46:53 Done.
849 _assertCompilationUnitMatches(false, r'''
850 main({int oldName}) {
851 }
852 ''', r'''
853 main({int newName}) {
854 }
855 ''');
856 }
857
858 void test_false_SimpleFormalParameter_namedDefault_differentValue() {
859 _assertCompilationUnitMatches(false, r'''
860 main({int p: 1}) {
861 }
862 ''', r'''
863 main({int p: 2}) {
864 }
865 ''');
866 }
867
868 void test_false_SimpleFormalParameter_optionalDefault_addValue() {
869 _assertCompilationUnitMatches(false, r'''
870 main([int p]) {
871 }
872 ''', r'''
873 main([int p = 2]) {
874 }
875 ''');
876 }
877
878 void test_false_SimpleFormalParameter_optionalDefault_differentValue() {
879 _assertCompilationUnitMatches(false, r'''
880 main([int p = 1]) {
881 }
882 ''', r'''
883 main([int p = 2]) {
884 }
885 ''');
886 }
887
888 void test_false_SimpleFormalParameter_optionalDefault_removeValue() {
889 _assertCompilationUnitMatches(false, r'''
890 main([int p = 1]) {
891 }
892 ''', r'''
893 main([int p]) {
894 }
895 ''');
896 }
897
798 void test_false_topLevelAccessor_list_add() { 898 void test_false_topLevelAccessor_list_add() {
799 _assertCompilationUnitMatches(false, r''' 899 _assertCompilationUnitMatches(false, r'''
800 get a => 1; 900 get a => 1;
801 get b => 2; 901 get b => 2;
802 ''', r''' 902 ''', r'''
803 get a => 1; 903 get a => 1;
804 get b => 2; 904 get b => 2;
805 get c => 3; 905 get c => 3;
806 '''); 906 ''');
807 } 907 }
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 } 1429 }
1330 ''', r''' 1430 ''', r'''
1331 class T { 1431 class T {
1332 int A = 1; 1432 int A = 1;
1333 int B = 2; 1433 int B = 2;
1334 int C = 3; 1434 int C = 3;
1335 } 1435 }
1336 '''); 1436 ''');
1337 } 1437 }
1338 1438
1339 void test_true_fieldFormalParameterElement() { 1439 void test_true_fieldFormalParameter() {
1340 _assertCompilationUnitMatches(true, r''' 1440 _assertCompilationUnitMatches(true, r'''
1341 class A { 1441 class A {
1342 int field; 1442 int field;
1343 A(this.field); 1443 A(this.field);
1344 } 1444 }
1345 ''', r''' 1445 ''', r'''
1346 class A { 1446 class A {
1347 int field; 1447 int field;
1348 A(this.field); 1448 A(this.field);
1349 } 1449 }
(...skipping 25 matching lines...) Expand all
1375 } 1475 }
1376 1476
1377 void test_true_functionTypeAlias_typeParameters_list_same() { 1477 void test_true_functionTypeAlias_typeParameters_list_same() {
1378 _assertCompilationUnitMatches(true, r''' 1478 _assertCompilationUnitMatches(true, r'''
1379 typedef F<A, B, C>(); 1479 typedef F<A, B, C>();
1380 ''', r''' 1480 ''', r'''
1381 typedef F<A, B, C>(); 1481 typedef F<A, B, C>();
1382 '''); 1482 ''');
1383 } 1483 }
1384 1484
1485 void test_true_FunctionTypedFormalParameter() {
1486 _assertCompilationUnitMatches(true, r'''
1487 main(int callback(int a, String b)) {
1488 }
1489 ''', r'''
1490 main(int callback(int a, String b)) {
1491 }
1492 ''');
1493 }
1494
1385 void test_true_implementsClause_same() { 1495 void test_true_implementsClause_same() {
1386 _assertCompilationUnitMatches(true, r''' 1496 _assertCompilationUnitMatches(true, r'''
1387 class A {} 1497 class A {}
1388 class B implements A {} 1498 class B implements A {}
1389 ''', r''' 1499 ''', r'''
1390 class A {} 1500 class A {}
1391 class B implements A {} 1501 class B implements A {}
1392 '''); 1502 ''');
1393 } 1503 }
1394 1504
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 library lib; 1635 library lib;
1526 part 'unitA.dart'; 1636 part 'unitA.dart';
1527 part 'unitB.dart'; 1637 part 'unitB.dart';
1528 ''', r''' 1638 ''', r'''
1529 library lib; 1639 library lib;
1530 part 'unitA.dart'; 1640 part 'unitA.dart';
1531 part 'unitB.dart'; 1641 part 'unitB.dart';
1532 '''); 1642 ''');
1533 } 1643 }
1534 1644
1645 void test_true_SimpleFormalParameter_optional_differentName() {
1646 _assertCompilationUnitMatches(true, r'''
1647 main([int oldName]) {
1648 }
1649 ''', r'''
1650 main([int newName]) {
1651 }
1652 ''');
1653 }
1654
1655 void test_true_SimpleFormalParameter_optionalDefault_differentName() {
1656 _assertCompilationUnitMatches(true, r'''
1657 main([int oldName = 1]) {
1658 }
1659 ''', r'''
1660 main([int newName = 1]) {
1661 }
1662 ''');
1663 }
1664
1665 void test_true_SimpleFormalParameter_required_differentName() {
1666 _assertCompilationUnitMatches(true, r'''
1667 main(int oldName) {
1668 }
1669 ''', r'''
1670 main(int newName) {
1671 }
1672 ''');
1673 }
1674
1535 void test_true_topLevelAccessor_list_reorder() { 1675 void test_true_topLevelAccessor_list_reorder() {
1536 _assertCompilationUnitMatches(true, r''' 1676 _assertCompilationUnitMatches(true, r'''
1537 set a(x) {} 1677 set a(x) {}
1538 set b(x) {} 1678 set b(x) {}
1539 set c(x) {} 1679 set c(x) {}
1540 ''', r''' 1680 ''', r'''
1541 set c(x) {} 1681 set c(x) {}
1542 set a(x) {} 1682 set a(x) {}
1543 set b(x) {} 1683 set b(x) {}
1544 '''); 1684 ''');
(...skipping 1928 matching lines...) Expand 10 before | Expand all | Expand 10 after
3473 _visitList(node.metadata, other.metadata); 3613 _visitList(node.metadata, other.metadata);
3474 _visitNode(node.identifier, other.identifier); 3614 _visitNode(node.identifier, other.identifier);
3475 } 3615 }
3476 3616
3477 static void assertSameResolution(CompilationUnit actual, 3617 static void assertSameResolution(CompilationUnit actual,
3478 CompilationUnit expected) { 3618 CompilationUnit expected) {
3479 _SameResolutionValidator validator = new _SameResolutionValidator(expected); 3619 _SameResolutionValidator validator = new _SameResolutionValidator(expected);
3480 actual.accept(validator); 3620 actual.accept(validator);
3481 } 3621 }
3482 } 3622 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698