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

Side by Side Diff: test/dependency_graph_test.dart

Issue 1020043002: Replace dart_core.js with actual compiled SDK (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: merge Created 5 years, 9 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
« no previous file with comments | « test/codegen_test.dart ('k') | test/generated_sdk/lib/core/core.dart » ('j') | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 dev_compiler.test.dependency_graph_test; 5 library dev_compiler.test.dependency_graph_test;
6 6
7 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 8
9 import 'package:dev_compiler/src/checker/dart_sdk.dart' 9 import 'package:dev_compiler/src/checker/dart_sdk.dart'
10 show mockSdkSources, dartSdkDirectory; 10 show mockSdkSources, dartSdkDirectory;
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 expect(node.structureChanged, isTrue); 546 expect(node.structureChanged, isTrue);
547 }); 547 });
548 }); 548 });
549 }); 549 });
550 550
551 group('refresh structure and marks', () { 551 group('refresh structure and marks', () {
552 test('initial marks', () { 552 test('initial marks', () {
553 var node = nodeOf('/index3.html'); 553 var node = nodeOf('/index3.html');
554 expectGraph(node, ''' 554 expectGraph(node, '''
555 index3.html 555 index3.html
556 |-- harmony_feature_check.js 556 $_RUNTIME_GRAPH
557 |-- dart_runtime.js
558 |-- dart_core.js
559 '''); 557 ''');
560 refreshStructureAndMarks(node, graph); 558 refreshStructureAndMarks(node, graph);
561 expectGraph(node, ''' 559 expectGraph(node, '''
562 index3.html [needs-rebuild] [structure-changed] 560 index3.html [needs-rebuild] [structure-changed]
563 |-- a2.dart [needs-rebuild] [structure-changed] 561 |-- a2.dart [needs-rebuild] [structure-changed]
564 | |-- a3.dart [needs-rebuild] 562 | |-- a3.dart [needs-rebuild]
565 | |-- a4.dart [needs-rebuild] [structure-changed] 563 | |-- a4.dart [needs-rebuild] [structure-changed]
566 | | |-- a10.dart [needs-rebuild] 564 | | |-- a10.dart [needs-rebuild]
567 | |-- a5.dart [needs-rebuild] 565 | |-- a5.dart [needs-rebuild]
568 | |-- a6.dart (part) [needs-rebuild] 566 | |-- a6.dart (part) [needs-rebuild]
569 |-- harmony_feature_check.js [needs-rebuild] 567 $_RUNTIME_GRAPH_REBUILD
570 |-- dart_runtime.js [needs-rebuild]
571 |-- dart_core.js [needs-rebuild]
572 '''); 568 ''');
573 }); 569 });
574 570
575 test('cleared marks stay clear', () { 571 test('cleared marks stay clear', () {
576 var node = nodeOf('/index3.html'); 572 var node = nodeOf('/index3.html');
577 refreshStructureAndMarks(node, graph); 573 refreshStructureAndMarks(node, graph);
578 expectGraph(node, ''' 574 expectGraph(node, '''
579 index3.html [needs-rebuild] [structure-changed] 575 index3.html [needs-rebuild] [structure-changed]
580 |-- a2.dart [needs-rebuild] [structure-changed] 576 |-- a2.dart [needs-rebuild] [structure-changed]
581 | |-- a3.dart [needs-rebuild] 577 | |-- a3.dart [needs-rebuild]
582 | |-- a4.dart [needs-rebuild] [structure-changed] 578 | |-- a4.dart [needs-rebuild] [structure-changed]
583 | | |-- a10.dart [needs-rebuild] 579 | | |-- a10.dart [needs-rebuild]
584 | |-- a5.dart [needs-rebuild] 580 | |-- a5.dart [needs-rebuild]
585 | |-- a6.dart (part) [needs-rebuild] 581 | |-- a6.dart (part) [needs-rebuild]
586 |-- harmony_feature_check.js [needs-rebuild] 582 $_RUNTIME_GRAPH_REBUILD
587 |-- dart_runtime.js [needs-rebuild]
588 |-- dart_core.js [needs-rebuild]
589 '''); 583 ''');
590 clearMarks(node); 584 clearMarks(node);
591 expectGraph(node, ''' 585 expectGraph(node, '''
592 index3.html 586 index3.html
593 |-- a2.dart 587 |-- a2.dart
594 | |-- a3.dart 588 | |-- a3.dart
595 | |-- a4.dart 589 | |-- a4.dart
596 | | |-- a10.dart 590 | | |-- a10.dart
597 | |-- a5.dart 591 | |-- a5.dart
598 | |-- a6.dart (part) 592 | |-- a6.dart (part)
599 |-- harmony_feature_check.js 593 $_RUNTIME_GRAPH
600 |-- dart_runtime.js
601 |-- dart_core.js
602 '''); 594 ''');
603 595
604 refreshStructureAndMarks(node, graph); 596 refreshStructureAndMarks(node, graph);
605 expectGraph(node, ''' 597 expectGraph(node, '''
606 index3.html 598 index3.html
607 |-- a2.dart 599 |-- a2.dart
608 | |-- a3.dart 600 | |-- a3.dart
609 | |-- a4.dart 601 | |-- a4.dart
610 | | |-- a10.dart 602 | | |-- a10.dart
611 | |-- a5.dart 603 | |-- a5.dart
612 | |-- a6.dart (part) 604 | |-- a6.dart (part)
613 |-- harmony_feature_check.js 605 $_RUNTIME_GRAPH
614 |-- dart_runtime.js
615 |-- dart_core.js
616 '''); 606 ''');
617 }); 607 });
618 608
619 test('needsRebuild mark updated on local modifications', () { 609 test('needsRebuild mark updated on local modifications', () {
620 var node = nodeOf('/index3.html'); 610 var node = nodeOf('/index3.html');
621 refreshStructureAndMarks(node, graph); 611 refreshStructureAndMarks(node, graph);
622 clearMarks(node); 612 clearMarks(node);
623 var a3 = nodeOf('/a3.dart'); 613 var a3 = nodeOf('/a3.dart');
624 a3.source.contents.modificationTime++; 614 a3.source.contents.modificationTime++;
625 615
626 refreshStructureAndMarks(node, graph); 616 refreshStructureAndMarks(node, graph);
627 expectGraph(node, ''' 617 expectGraph(node, '''
628 index3.html 618 index3.html
629 |-- a2.dart 619 |-- a2.dart
630 | |-- a3.dart [needs-rebuild] 620 | |-- a3.dart [needs-rebuild]
631 | |-- a4.dart 621 | |-- a4.dart
632 | | |-- a10.dart 622 | | |-- a10.dart
633 | |-- a5.dart 623 | |-- a5.dart
634 | |-- a6.dart (part) 624 | |-- a6.dart (part)
635 |-- harmony_feature_check.js 625 $_RUNTIME_GRAPH
636 |-- dart_runtime.js
637 |-- dart_core.js
638 '''); 626 ''');
639 }); 627 });
640 628
641 test('structuredChanged mark updated on structure modifications', () { 629 test('structuredChanged mark updated on structure modifications', () {
642 var node = nodeOf('/index3.html'); 630 var node = nodeOf('/index3.html');
643 refreshStructureAndMarks(node, graph); 631 refreshStructureAndMarks(node, graph);
644 clearMarks(node); 632 clearMarks(node);
645 var a5 = nodeOf('/a5.dart'); 633 var a5 = nodeOf('/a5.dart');
646 a5.source.contents.modificationTime++; 634 a5.source.contents.modificationTime++;
647 a5.source.contents.data = 'import "a8.dart";'; 635 a5.source.contents.data = 'import "a8.dart";';
648 636
649 refreshStructureAndMarks(node, graph); 637 refreshStructureAndMarks(node, graph);
650 expectGraph(node, ''' 638 expectGraph(node, '''
651 index3.html 639 index3.html
652 |-- a2.dart 640 |-- a2.dart
653 | |-- a3.dart 641 | |-- a3.dart
654 | |-- a4.dart 642 | |-- a4.dart
655 | | |-- a10.dart 643 | | |-- a10.dart
656 | |-- a5.dart [needs-rebuild] [structure-changed] 644 | |-- a5.dart [needs-rebuild] [structure-changed]
657 | | |-- a8.dart [needs-rebuild] [structure-changed] 645 | | |-- a8.dart [needs-rebuild] [structure-changed]
658 | | | |-- a8.dart... 646 | | | |-- a8.dart...
659 | |-- a6.dart (part) 647 | |-- a6.dart (part)
660 |-- harmony_feature_check.js 648 $_RUNTIME_GRAPH
661 |-- dart_runtime.js
662 |-- dart_core.js
663 '''); 649 ''');
664 }); 650 });
665 }); 651 });
666 652
667 group('server-mode', () { 653 group('server-mode', () {
668 setUp(() { 654 setUp(() {
669 var options2 = new CompilerOptions( 655 var options2 = new CompilerOptions(
670 runtimeDir: '/dev_compiler_runtime/', serverMode: true); 656 runtimeDir: '/dev_compiler_runtime/', serverMode: true);
671 context = new TypeResolver.fromMock(mockSdkSources, options2, 657 context = new TypeResolver.fromMock(mockSdkSources, options2,
672 otherResolvers: [testUriResolver]).context; 658 otherResolvers: [testUriResolver]).context;
673 graph = new SourceGraph(context, new LogReporter(), options2); 659 graph = new SourceGraph(context, new LogReporter(), options2);
674 }); 660 });
675 661
676 test('messages widget is automatically included', () { 662 test('messages widget is automatically included', () {
677 var node = nodeOf('/index3.html'); 663 var node = nodeOf('/index3.html');
678 expectGraph(node, ''' 664 expectGraph(node, '''
679 index3.html 665 index3.html
680 |-- harmony_feature_check.js 666 $_RUNTIME_GRAPH
681 |-- dart_runtime.js
682 |-- dart_core.js
683 |-- messages_widget.js 667 |-- messages_widget.js
684 |-- messages.css 668 |-- messages.css
685 '''); 669 ''');
686 refreshStructureAndMarks(node, graph); 670 refreshStructureAndMarks(node, graph);
687 expectGraph(node, ''' 671 expectGraph(node, '''
688 index3.html [needs-rebuild] [structure-changed] 672 index3.html [needs-rebuild] [structure-changed]
689 |-- a2.dart [needs-rebuild] [structure-changed] 673 |-- a2.dart [needs-rebuild] [structure-changed]
690 | |-- a3.dart [needs-rebuild] 674 | |-- a3.dart [needs-rebuild]
691 | |-- a4.dart [needs-rebuild] [structure-changed] 675 | |-- a4.dart [needs-rebuild] [structure-changed]
692 | | |-- a10.dart [needs-rebuild] 676 | | |-- a10.dart [needs-rebuild]
693 | |-- a5.dart [needs-rebuild] 677 | |-- a5.dart [needs-rebuild]
694 | |-- a6.dart (part) [needs-rebuild] 678 | |-- a6.dart (part) [needs-rebuild]
695 |-- harmony_feature_check.js [needs-rebuild] 679 $_RUNTIME_GRAPH_REBUILD
696 |-- dart_runtime.js [needs-rebuild]
697 |-- dart_core.js [needs-rebuild]
698 |-- messages_widget.js [needs-rebuild] 680 |-- messages_widget.js [needs-rebuild]
699 |-- messages.css [needs-rebuild] 681 |-- messages.css [needs-rebuild]
700 '''); 682 ''');
701 }); 683 });
702 }); 684 });
703 685
704 group('rebuild', () { 686 group('rebuild', () {
705 var results; 687 var results;
706 void addName(SourceNode n) => results.add(nameFor(n)); 688 void addName(SourceNode n) => results.add(nameFor(n));
707 689
708 bool buildNoTransitiveChange(SourceNode n) { 690 bool buildNoTransitiveChange(SourceNode n) {
709 addName(n); 691 addName(n);
710 return false; 692 return false;
711 } 693 }
712 694
713 bool buildWithTransitiveChange(SourceNode n) { 695 bool buildWithTransitiveChange(SourceNode n) {
714 addName(n); 696 addName(n);
715 return true; 697 return true;
716 } 698 }
717 699
718 setUp(() { 700 setUp(() {
719 results = []; 701 results = [];
720 }); 702 });
721 703
722 test('everything build on first run', () { 704 test('everything build on first run', () {
723 var node = nodeOf('/index3.html'); 705 var node = nodeOf('/index3.html');
724 rebuild(node, graph, buildNoTransitiveChange); 706 rebuild(node, graph, buildNoTransitiveChange);
725 // Note: a6.dart is not included because it built as part of a2.dart 707 // Note: a6.dart is not included because it built as part of a2.dart
726 expect(results, [ 708 expect(results, ['a3.dart', 'a10.dart', 'a4.dart', 'a5.dart', 'a2.dart']
727 'a3.dart', 709 ..addAll(runtimeFilesWithoutPath)
728 'a10.dart', 710 ..add('index3.html'));
729 'a4.dart',
730 'a5.dart',
731 'a2.dart',
732 'harmony_feature_check.js',
733 'dart_runtime.js',
734 'dart_core.js',
735 'index3.html',
736 ]);
737 711
738 // Marks are removed automatically by rebuild 712 // Marks are removed automatically by rebuild
739 expectGraph(node, ''' 713 expectGraph(node, '''
740 index3.html 714 index3.html
741 |-- a2.dart 715 |-- a2.dart
742 | |-- a3.dart 716 | |-- a3.dart
743 | |-- a4.dart 717 | |-- a4.dart
744 | | |-- a10.dart 718 | | |-- a10.dart
745 | |-- a5.dart 719 | |-- a5.dart
746 | |-- a6.dart (part) 720 | |-- a6.dart (part)
747 |-- harmony_feature_check.js 721 $_RUNTIME_GRAPH
748 |-- dart_runtime.js
749 |-- dart_core.js
750 '''); 722 ''');
751 }); 723 });
752 724
753 test('nothing to do after build', () { 725 test('nothing to do after build', () {
754 var node = nodeOf('/index3.html'); 726 var node = nodeOf('/index3.html');
755 rebuild(node, graph, buildNoTransitiveChange); 727 rebuild(node, graph, buildNoTransitiveChange);
756 728
757 results = []; 729 results = [];
758 rebuild(node, graph, buildNoTransitiveChange); 730 rebuild(node, graph, buildNoTransitiveChange);
759 expect(results, []); 731 expect(results, []);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 rebuild(node, graph, buildNoTransitiveChange); 862 rebuild(node, graph, buildNoTransitiveChange);
891 863
892 expectGraph(node, ''' 864 expectGraph(node, '''
893 index3.html 865 index3.html
894 |-- a2.dart 866 |-- a2.dart
895 | |-- a3.dart 867 | |-- a3.dart
896 | |-- a4.dart 868 | |-- a4.dart
897 | | |-- a10.dart 869 | | |-- a10.dart
898 | |-- a5.dart 870 | |-- a5.dart
899 | |-- a6.dart (part) 871 | |-- a6.dart (part)
900 |-- harmony_feature_check.js 872 $_RUNTIME_GRAPH
901 |-- dart_runtime.js
902 |-- dart_core.js
903 '''); 873 ''');
904 874
905 // Modify the file first: 875 // Modify the file first:
906 a6.source.contents.modificationTime++; 876 a6.source.contents.modificationTime++;
907 a6.source.contents.data = 'library a6; import "a5.dart";'; 877 a6.source.contents.data = 'library a6; import "a5.dart";';
908 results = []; 878 results = [];
909 rebuild(node, graph, buildNoTransitiveChange); 879 rebuild(node, graph, buildNoTransitiveChange);
910 880
911 // Looks to us like a change in a part, we'll report errors that the 881 // Looks to us like a change in a part, we'll report errors that the
912 // part is not really a part-file. Note that a6.dart is not included 882 // part is not really a part-file. Note that a6.dart is not included
913 // below, because we don't build it as a library. 883 // below, because we don't build it as a library.
914 expect(results, ['a2.dart']); 884 expect(results, ['a2.dart']);
915 expectGraph(node, ''' 885 expectGraph(node, '''
916 index3.html 886 index3.html
917 |-- a2.dart 887 |-- a2.dart
918 | |-- a3.dart 888 | |-- a3.dart
919 | |-- a4.dart 889 | |-- a4.dart
920 | | |-- a10.dart 890 | | |-- a10.dart
921 | |-- a5.dart 891 | |-- a5.dart
922 | |-- a6.dart (part) 892 | |-- a6.dart (part)
923 |-- harmony_feature_check.js 893 $_RUNTIME_GRAPH
924 |-- dart_runtime.js
925 |-- dart_core.js
926 '''); 894 ''');
927 895
928 a2.source.contents.modificationTime++; 896 a2.source.contents.modificationTime++;
929 a2.source.contents.data = ''' 897 a2.source.contents.data = '''
930 library a2; 898 library a2;
931 import 'a3.dart'; 899 import 'a3.dart';
932 import 'a4.dart'; 900 import 'a4.dart';
933 import 'a6.dart'; // properly import it 901 import 'a6.dart'; // properly import it
934 export 'a5.dart'; 902 export 'a5.dart';
935 '''; 903 ''';
(...skipping 10 matching lines...) Expand all
946 914
947 expectGraph(node, ''' 915 expectGraph(node, '''
948 index3.html 916 index3.html
949 |-- a2.dart 917 |-- a2.dart
950 | |-- a3.dart 918 | |-- a3.dart
951 | |-- a4.dart 919 | |-- a4.dart
952 | | |-- a10.dart 920 | | |-- a10.dart
953 | |-- a6.dart 921 | |-- a6.dart
954 | | |-- a5.dart 922 | | |-- a5.dart
955 | |-- a5.dart... 923 | |-- a5.dart...
956 |-- harmony_feature_check.js 924 $_RUNTIME_GRAPH
957 |-- dart_runtime.js
958 |-- dart_core.js
959 '''); 925 ''');
960 }); 926 });
961 927
962 test('convert part to a library after updating the import', () { 928 test('convert part to a library after updating the import', () {
963 var node = nodeOf('/index3.html'); 929 var node = nodeOf('/index3.html');
964 var a2 = nodeOf('/a2.dart'); 930 var a2 = nodeOf('/a2.dart');
965 var a6 = nodeOf('/a6.dart'); 931 var a6 = nodeOf('/a6.dart');
966 rebuild(node, graph, buildNoTransitiveChange); 932 rebuild(node, graph, buildNoTransitiveChange);
967 933
968 expectGraph(node, ''' 934 expectGraph(node, '''
969 index3.html 935 index3.html
970 |-- a2.dart 936 |-- a2.dart
971 | |-- a3.dart 937 | |-- a3.dart
972 | |-- a4.dart 938 | |-- a4.dart
973 | | |-- a10.dart 939 | | |-- a10.dart
974 | |-- a5.dart 940 | |-- a5.dart
975 | |-- a6.dart (part) 941 | |-- a6.dart (part)
976 |-- harmony_feature_check.js 942 $_RUNTIME_GRAPH
977 |-- dart_runtime.js
978 |-- dart_core.js
979 '''); 943 ''');
980 944
981 a2.source.contents.modificationTime++; 945 a2.source.contents.modificationTime++;
982 a2.source.contents.data = ''' 946 a2.source.contents.data = '''
983 library a2; 947 library a2;
984 import 'a3.dart'; 948 import 'a3.dart';
985 import 'a4.dart'; 949 import 'a4.dart';
986 import 'a6.dart'; // properly import it 950 import 'a6.dart'; // properly import it
987 export 'a5.dart'; 951 export 'a5.dart';
988 '''; 952 ''';
989 results = []; 953 results = [];
990 rebuild(node, graph, buildNoTransitiveChange); 954 rebuild(node, graph, buildNoTransitiveChange);
991 expect(results, ['a6.dart', 'a2.dart', 'index3.html']); 955 expect(results, ['a6.dart', 'a2.dart', 'index3.html']);
992 expectGraph(node, ''' 956 expectGraph(node, '''
993 index3.html 957 index3.html
994 |-- a2.dart 958 |-- a2.dart
995 | |-- a3.dart 959 | |-- a3.dart
996 | |-- a4.dart 960 | |-- a4.dart
997 | | |-- a10.dart 961 | | |-- a10.dart
998 | |-- a6.dart 962 | |-- a6.dart
999 | |-- a5.dart 963 | |-- a5.dart
1000 |-- harmony_feature_check.js 964 $_RUNTIME_GRAPH
1001 |-- dart_runtime.js
1002 |-- dart_core.js
1003 '''); 965 ''');
1004 966
1005 a6.source.contents.modificationTime++; 967 a6.source.contents.modificationTime++;
1006 a6.source.contents.data = 'library a6; import "a5.dart";'; 968 a6.source.contents.data = 'library a6; import "a5.dart";';
1007 results = []; 969 results = [];
1008 rebuild(node, graph, buildNoTransitiveChange); 970 rebuild(node, graph, buildNoTransitiveChange);
1009 expect(results, ['a6.dart', 'index3.html']); 971 expect(results, ['a6.dart', 'index3.html']);
1010 expectGraph(node, ''' 972 expectGraph(node, '''
1011 index3.html 973 index3.html
1012 |-- a2.dart 974 |-- a2.dart
1013 | |-- a3.dart 975 | |-- a3.dart
1014 | |-- a4.dart 976 | |-- a4.dart
1015 | | |-- a10.dart 977 | | |-- a10.dart
1016 | |-- a6.dart 978 | |-- a6.dart
1017 | | |-- a5.dart 979 | | |-- a5.dart
1018 | |-- a5.dart... 980 | |-- a5.dart...
1019 |-- harmony_feature_check.js 981 $_RUNTIME_GRAPH
1020 |-- dart_runtime.js
1021 |-- dart_core.js
1022 '''); 982 ''');
1023 }); 983 });
1024 984
1025 test('disconnect part making it a library', () { 985 test('disconnect part making it a library', () {
1026 var node = nodeOf('/index3.html'); 986 var node = nodeOf('/index3.html');
1027 var a2 = nodeOf('/a2.dart'); 987 var a2 = nodeOf('/a2.dart');
1028 var a6 = nodeOf('/a6.dart'); 988 var a6 = nodeOf('/a6.dart');
1029 rebuild(node, graph, buildNoTransitiveChange); 989 rebuild(node, graph, buildNoTransitiveChange);
1030 990
1031 expectGraph(node, ''' 991 expectGraph(node, '''
1032 index3.html 992 index3.html
1033 |-- a2.dart 993 |-- a2.dart
1034 | |-- a3.dart 994 | |-- a3.dart
1035 | |-- a4.dart 995 | |-- a4.dart
1036 | | |-- a10.dart 996 | | |-- a10.dart
1037 | |-- a5.dart 997 | |-- a5.dart
1038 | |-- a6.dart (part) 998 | |-- a6.dart (part)
1039 |-- harmony_feature_check.js 999 $_RUNTIME_GRAPH
1040 |-- dart_runtime.js
1041 |-- dart_core.js
1042 '''); 1000 ''');
1043 1001
1044 a2.source.contents.modificationTime++; 1002 a2.source.contents.modificationTime++;
1045 a2.source.contents.data = ''' 1003 a2.source.contents.data = '''
1046 library a2; 1004 library a2;
1047 import 'a3.dart'; 1005 import 'a3.dart';
1048 import 'a4.dart'; 1006 import 'a4.dart';
1049 export 'a5.dart'; 1007 export 'a5.dart';
1050 '''; 1008 ''';
1051 a6.source.contents.modificationTime++; 1009 a6.source.contents.modificationTime++;
1052 a6.source.contents.data = 'library a6; import "a5.dart";'; 1010 a6.source.contents.data = 'library a6; import "a5.dart";';
1053 results = []; 1011 results = [];
1054 rebuild(node, graph, buildNoTransitiveChange); 1012 rebuild(node, graph, buildNoTransitiveChange);
1055 // a6 is not here, it's not reachable so we don't build it. 1013 // a6 is not here, it's not reachable so we don't build it.
1056 expect(results, ['a2.dart', 'index3.html']); 1014 expect(results, ['a2.dart', 'index3.html']);
1057 expectGraph(node, ''' 1015 expectGraph(node, '''
1058 index3.html 1016 index3.html
1059 |-- a2.dart 1017 |-- a2.dart
1060 | |-- a3.dart 1018 | |-- a3.dart
1061 | |-- a4.dart 1019 | |-- a4.dart
1062 | | |-- a10.dart 1020 | | |-- a10.dart
1063 | |-- a5.dart 1021 | |-- a5.dart
1064 |-- harmony_feature_check.js 1022 $_RUNTIME_GRAPH
1065 |-- dart_runtime.js
1066 |-- dart_core.js
1067 '''); 1023 ''');
1068 }); 1024 });
1069 1025
1070 test('convert a library to a part', () { 1026 test('convert a library to a part', () {
1071 var node = nodeOf('/index3.html'); 1027 var node = nodeOf('/index3.html');
1072 var a2 = nodeOf('/a2.dart'); 1028 var a2 = nodeOf('/a2.dart');
1073 var a5 = nodeOf('/a5.dart'); 1029 var a5 = nodeOf('/a5.dart');
1074 rebuild(node, graph, buildNoTransitiveChange); 1030 rebuild(node, graph, buildNoTransitiveChange);
1075 1031
1076 expectGraph(node, ''' 1032 expectGraph(node, '''
1077 index3.html 1033 index3.html
1078 |-- a2.dart 1034 |-- a2.dart
1079 | |-- a3.dart 1035 | |-- a3.dart
1080 | |-- a4.dart 1036 | |-- a4.dart
1081 | | |-- a10.dart 1037 | | |-- a10.dart
1082 | |-- a5.dart 1038 | |-- a5.dart
1083 | |-- a6.dart (part) 1039 | |-- a6.dart (part)
1084 |-- harmony_feature_check.js 1040 $_RUNTIME_GRAPH
1085 |-- dart_runtime.js
1086 |-- dart_core.js
1087 '''); 1041 ''');
1088 1042
1089 a2.source.contents.modificationTime++; 1043 a2.source.contents.modificationTime++;
1090 a2.source.contents.data = ''' 1044 a2.source.contents.data = '''
1091 library a2; 1045 library a2;
1092 import 'a3.dart'; 1046 import 'a3.dart';
1093 import 'a4.dart'; 1047 import 'a4.dart';
1094 part 'a5.dart'; // make it a part 1048 part 'a5.dart'; // make it a part
1095 part 'a6.dart'; 1049 part 'a6.dart';
1096 '''; 1050 ''';
1097 results = []; 1051 results = [];
1098 rebuild(node, graph, buildNoTransitiveChange); 1052 rebuild(node, graph, buildNoTransitiveChange);
1099 expect(results, ['a2.dart', 'index3.html']); 1053 expect(results, ['a2.dart', 'index3.html']);
1100 expectGraph(node, ''' 1054 expectGraph(node, '''
1101 index3.html 1055 index3.html
1102 |-- a2.dart 1056 |-- a2.dart
1103 | |-- a3.dart 1057 | |-- a3.dart
1104 | |-- a4.dart 1058 | |-- a4.dart
1105 | | |-- a10.dart 1059 | | |-- a10.dart
1106 | |-- a5.dart (part) 1060 | |-- a5.dart (part)
1107 | |-- a6.dart (part) 1061 | |-- a6.dart (part)
1108 |-- harmony_feature_check.js 1062 $_RUNTIME_GRAPH
1109 |-- dart_runtime.js
1110 |-- dart_core.js
1111 '''); 1063 ''');
1112 1064
1113 a5.source.contents.modificationTime++; 1065 a5.source.contents.modificationTime++;
1114 a5.source.contents.data = 'part of a2;'; 1066 a5.source.contents.data = 'part of a2;';
1115 results = []; 1067 results = [];
1116 rebuild(node, graph, buildNoTransitiveChange); 1068 rebuild(node, graph, buildNoTransitiveChange);
1117 expect(results, ['a2.dart']); 1069 expect(results, ['a2.dart']);
1118 expectGraph(node, ''' 1070 expectGraph(node, '''
1119 index3.html 1071 index3.html
1120 |-- a2.dart 1072 |-- a2.dart
1121 | |-- a3.dart 1073 | |-- a3.dart
1122 | |-- a4.dart 1074 | |-- a4.dart
1123 | | |-- a10.dart 1075 | | |-- a10.dart
1124 | |-- a5.dart (part) 1076 | |-- a5.dart (part)
1125 | |-- a6.dart (part) 1077 | |-- a6.dart (part)
1126 |-- harmony_feature_check.js 1078 $_RUNTIME_GRAPH
1127 |-- dart_runtime.js
1128 |-- dart_core.js
1129 '''); 1079 ''');
1130 }); 1080 });
1131 }); 1081 });
1132 1082
1133 group('represented non-existing files', () { 1083 group('represented non-existing files', () {
1134 test('recognize locally change between existing and not-existing', () { 1084 test('recognize locally change between existing and not-existing', () {
1135 var n = nodeOf('/foo.dart'); 1085 var n = nodeOf('/foo.dart');
1136 expect(n.source, isNotNull); 1086 expect(n.source, isNotNull);
1137 expect(n.source.exists(), isFalse); 1087 expect(n.source.exists(), isFalse);
1138 var source = testUriResolver.files[new Uri.file('/foo.dart')]; 1088 var source = testUriResolver.files[new Uri.file('/foo.dart')];
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 ..write(e.needsRebuild ? '[needs-rebuild] ' : '') 1184 ..write(e.needsRebuild ? '[needs-rebuild] ' : '')
1235 ..write(e.structureChanged ? '[structure-changed] ' : ' ') 1185 ..write(e.structureChanged ? '[structure-changed] ' : ' ')
1236 ..write('\n'); 1186 ..write('\n');
1237 }); 1187 });
1238 } 1188 }
1239 } 1189 }
1240 helper(node); 1190 helper(node);
1241 return sb.toString(); 1191 return sb.toString();
1242 } 1192 }
1243 1193
1194 final runtimeFilesWithoutPath = defaultRuntimeFiles
1195 .map((f) => f.replaceAll('dart/', ''))
1196 .toList(growable: false);
1197 final _RUNTIME_GRAPH = runtimeFilesWithoutPath.map((s) => '|-- $s').join('\n');
1198 final _RUNTIME_GRAPH_REBUILD =
1199 runtimeFilesWithoutPath.map((s) => '|-- $s [needs-rebuild]').join('\n');
1200
1244 bool _same(Set a, Set b) => a.length == b.length && a.containsAll(b); 1201 bool _same(Set a, Set b) => a.length == b.length && a.containsAll(b);
OLDNEW
« no previous file with comments | « test/codegen_test.dart ('k') | test/generated_sdk/lib/core/core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698