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

Side by Side Diff: pkg/analyzer/test/src/summary/resynthesize_test.dart

Issue 1589573003: Include the export namespace in the prelinked summary. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
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 test.src.serialization.elements_test; 5 library test.src.serialization.elements_test;
6 6
7 import 'package:analyzer/src/generated/element.dart'; 7 import 'package:analyzer/src/generated/element.dart';
8 import 'package:analyzer/src/generated/element_handle.dart';
8 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
9 import 'package:analyzer/src/generated/resolver.dart' show Namespace; 10 import 'package:analyzer/src/generated/resolver.dart' show Namespace;
10 import 'package:analyzer/src/generated/source.dart'; 11 import 'package:analyzer/src/generated/source.dart';
11 import 'package:analyzer/src/summary/format.dart'; 12 import 'package:analyzer/src/summary/format.dart';
12 import 'package:analyzer/src/summary/resynthesize.dart'; 13 import 'package:analyzer/src/summary/resynthesize.dart';
13 import 'package:analyzer/src/summary/summarize_elements.dart'; 14 import 'package:analyzer/src/summary/summarize_elements.dart';
14 import 'package:unittest/unittest.dart'; 15 import 'package:unittest/unittest.dart';
15 16
16 import '../../generated/resolver_test.dart'; 17 import '../../generated/resolver_test.dart';
17 import '../../reflective_tests.dart'; 18 import '../../reflective_tests.dart';
18 19
19 main() { 20 main() {
20 groupSep = ' | '; 21 groupSep = ' | ';
21 runReflectiveTests(ResynthTest); 22 runReflectiveTests(ResynthTest);
22 } 23 }
23 24
24 @reflectiveTest 25 @reflectiveTest
25 class ResynthTest extends ResolverTestCase { 26 class ResynthTest extends ResolverTestCase {
26 Set<Source> otherLibrarySources = new Set<Source>(); 27 Set<Source> otherLibrarySources = new Set<Source>();
27 28
28 void addLibrary(String uri) { 29 void addLibrary(String uri) {
29 otherLibrarySources.add(analysisContext2.sourceFactory.forUri(uri)); 30 otherLibrarySources.add(analysisContext2.sourceFactory.forUri(uri));
30 } 31 }
31 32
32 void addLibrarySource(String filePath, String contents) { 33 void addLibrarySource(String filePath, String contents) {
33 otherLibrarySources.add(addNamedSource(filePath, contents)); 34 otherLibrarySources.add(addNamedSource(filePath, contents));
34 } 35 }
35 36
36 void checkLibrary(String text, 37 void checkLibrary(String text, {bool allowErrors: false}) {
37 {bool allowErrors: false, int resynthesisCount: 1}) {
38 Source source = addSource(text); 38 Source source = addSource(text);
39 LibraryElementImpl original = resolve2(source); 39 LibraryElementImpl original = resolve2(source);
40 LibraryElementImpl resynthesized = resynthesizeLibrary( 40 LibraryElementImpl resynthesized =
41 source, original, allowErrors, 41 resynthesizeLibrary(source, original, allowErrors);
42 resynthesisCount: resynthesisCount);
43 checkLibraryElements(original, resynthesized); 42 checkLibraryElements(original, resynthesized);
44 } 43 }
45 44
46 void checkLibraryElements( 45 void checkLibraryElements(
47 LibraryElementImpl original, LibraryElementImpl resynthesized) { 46 LibraryElementImpl original, LibraryElementImpl resynthesized) {
48 compareElements(resynthesized, original, '(library)'); 47 compareElements(resynthesized, original, '(library)');
49 expect(resynthesized.displayName, original.displayName); 48 expect(resynthesized.displayName, original.displayName);
50 expect(original.enclosingElement, isNull); 49 expect(original.enclosingElement, isNull);
51 expect(resynthesized.enclosingElement, isNull); 50 expect(resynthesized.enclosingElement, isNull);
52 expect(resynthesized.hasExtUri, original.hasExtUri); 51 expect(resynthesized.hasExtUri, original.hasExtUri);
53 compareCompilationUnitElements(resynthesized.definingCompilationUnit, 52 compareCompilationUnitElements(resynthesized.definingCompilationUnit,
54 original.definingCompilationUnit); 53 original.definingCompilationUnit);
55 expect(resynthesized.parts.length, original.parts.length); 54 expect(resynthesized.parts.length, original.parts.length);
56 for (int i = 0; i < resynthesized.parts.length; i++) { 55 for (int i = 0; i < resynthesized.parts.length; i++) {
57 compareCompilationUnitElements(resynthesized.parts[i], original.parts[i]); 56 compareCompilationUnitElements(resynthesized.parts[i], original.parts[i]);
58 } 57 }
59 expect(resynthesized.imports.length, original.imports.length); 58 expect(resynthesized.imports.length, original.imports.length);
60 for (int i = 0; i < resynthesized.imports.length; i++) { 59 for (int i = 0; i < resynthesized.imports.length; i++) {
61 compareImportElements(resynthesized.imports[i], original.imports[i], 60 compareImportElements(resynthesized.imports[i], original.imports[i],
62 'import ${original.imports[i].uri}'); 61 'import ${original.imports[i].uri}');
63 } 62 }
64 expect(resynthesized.exports.length, original.exports.length); 63 expect(resynthesized.exports.length, original.exports.length);
65 for (int i = 0; i < resynthesized.exports.length; i++) { 64 for (int i = 0; i < resynthesized.exports.length; i++) {
66 compareExportElements(resynthesized.exports[i], original.exports[i], 65 compareExportElements(resynthesized.exports[i], original.exports[i],
67 'export ${original.exports[i].uri}'); 66 'export ${original.exports[i].uri}');
68 } 67 }
69 expect(resynthesized.nameLength, original.nameLength); 68 expect(resynthesized.nameLength, original.nameLength);
69 compareNamespaces(resynthesized.publicNamespace, original.publicNamespace,
70 '(public namespace)');
71 compareNamespaces(resynthesized.exportNamespace, original.exportNamespace,
72 '(export namespace)');
70 if (original.entryPoint == null) { 73 if (original.entryPoint == null) {
71 expect(resynthesized.entryPoint, isNull); 74 expect(resynthesized.entryPoint, isNull);
72 } else { 75 } else {
73 expect(resynthesized.entryPoint, isNotNull); 76 expect(resynthesized.entryPoint, isNotNull);
74 compareFunctionElements( 77 compareFunctionElements(
75 resynthesized.entryPoint, original.entryPoint, '(entry point)'); 78 resynthesized.entryPoint, original.entryPoint, '(entry point)');
76 } 79 }
77 compareNamespaces(resynthesized.publicNamespace, original.publicNamespace,
78 '(public namespace)');
79 compareNamespaces(resynthesized.exportNamespace, original.exportNamespace,
80 '(export namespace)');
81 compareExecutableElements( 80 compareExecutableElements(
82 resynthesized.loadLibraryFunction as ExecutableElementImpl, 81 resynthesized.loadLibraryFunction as ExecutableElementImpl,
83 original.loadLibraryFunction as ExecutableElementImpl, 82 original.loadLibraryFunction as ExecutableElementImpl,
84 '(loadLibraryFunction)'); 83 '(loadLibraryFunction)');
85 // TODO(paulberry): test metadata. 84 // TODO(paulberry): test metadata.
86 } 85 }
87 86
88 void compareClassElements( 87 void compareClassElements(
89 ClassElementImpl resynthesized, ClassElementImpl original, String desc) { 88 ClassElementImpl resynthesized, ClassElementImpl original, String desc) {
90 compareElements(resynthesized, original, desc); 89 compareElements(resynthesized, original, desc);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 193 }
195 // TODO(paulberry): test metadata and offsetToElementMap. 194 // TODO(paulberry): test metadata and offsetToElementMap.
196 } 195 }
197 196
198 void compareConstructorElements(ConstructorElementImpl resynthesized, 197 void compareConstructorElements(ConstructorElementImpl resynthesized,
199 ConstructorElementImpl original, String desc) { 198 ConstructorElementImpl original, String desc) {
200 compareExecutableElements(resynthesized, original, desc); 199 compareExecutableElements(resynthesized, original, desc);
201 // TODO(paulberry): test redirectedConstructor and constantInitializers 200 // TODO(paulberry): test redirectedConstructor and constantInitializers
202 } 201 }
203 202
204 void compareElements( 203 void compareElements(Element resynthesized, Element original, String desc) {
205 ElementImpl resynthesized, ElementImpl original, String desc) {
206 expect(resynthesized, isNotNull); 204 expect(resynthesized, isNotNull);
207 expect(resynthesized.kind, original.kind); 205 expect(resynthesized.kind, original.kind);
208 expect(resynthesized.location, original.location, reason: desc); 206 expect(resynthesized.location, original.location, reason: desc);
209 expect(resynthesized.name, original.name); 207 expect(resynthesized.name, original.name);
210 expect(resynthesized.nameOffset, original.nameOffset, reason: desc); 208 expect(resynthesized.nameOffset, original.nameOffset, reason: desc);
211 expect(resynthesized.documentationComment, original.documentationComment, 209 expect(resynthesized.documentationComment, original.documentationComment,
212 reason: desc); 210 reason: desc);
213 expect(resynthesized.docRange, original.docRange, reason: desc); 211 expect(resynthesized.docRange, original.docRange, reason: desc);
212 // Modifiers are a pain to test via handles. So just test them via the
213 // actual element.
214 ElementImpl actualResynthesized = getActualElement(resynthesized, desc);
215 ElementImpl actualOriginal = getActualElement(original, desc);
214 for (Modifier modifier in Modifier.values) { 216 for (Modifier modifier in Modifier.values) {
215 if (modifier == Modifier.MIXIN) { 217 if (modifier == Modifier.MIXIN) {
216 // Skipping for now. TODO(paulberry): fix. 218 // Skipping for now. TODO(paulberry): fix.
217 continue; 219 continue;
218 } 220 }
219 bool got = resynthesized.hasModifier(modifier); 221 bool got = actualResynthesized.hasModifier(modifier);
220 bool want = original.hasModifier(modifier); 222 bool want = actualOriginal.hasModifier(modifier);
221 expect(got, want, 223 expect(got, want,
222 reason: 'Mismatch in $desc.$modifier: got $got, want $want'); 224 reason: 'Mismatch in $desc.$modifier: got $got, want $want');
223 } 225 }
224 } 226 }
225 227
226 void compareExecutableElements(ExecutableElementImpl resynthesized, 228 void compareExecutableElements(ExecutableElement resynthesized,
227 ExecutableElementImpl original, String desc) { 229 ExecutableElement original, String desc) {
228 compareElements(resynthesized, original, desc); 230 compareElements(resynthesized, original, desc);
229 expect(resynthesized.parameters.length, original.parameters.length); 231 expect(resynthesized.parameters.length, original.parameters.length);
230 for (int i = 0; i < resynthesized.parameters.length; i++) { 232 for (int i = 0; i < resynthesized.parameters.length; i++) {
231 compareParameterElements( 233 compareParameterElements(
232 resynthesized.parameters[i], 234 resynthesized.parameters[i],
233 original.parameters[i], 235 original.parameters[i],
234 '$desc parameter ${original.parameters[i].name}'); 236 '$desc parameter ${original.parameters[i].name}');
235 } 237 }
236 compareTypes( 238 compareTypes(
237 resynthesized.returnType, original.returnType, '$desc return type'); 239 resynthesized.returnType, original.returnType, '$desc return type');
(...skipping 11 matching lines...) Expand all
249 resynthesized.combinators[i], original.combinators[i]); 251 resynthesized.combinators[i], original.combinators[i]);
250 } 252 }
251 } 253 }
252 254
253 void compareFieldElements( 255 void compareFieldElements(
254 FieldElementImpl resynthesized, FieldElementImpl original, String desc) { 256 FieldElementImpl resynthesized, FieldElementImpl original, String desc) {
255 comparePropertyInducingElements(resynthesized, original, desc); 257 comparePropertyInducingElements(resynthesized, original, desc);
256 // TODO(paulberry): test evaluationResult 258 // TODO(paulberry): test evaluationResult
257 } 259 }
258 260
259 void compareFunctionElements(FunctionElementImpl resynthesized, 261 void compareFunctionElements(
260 FunctionElementImpl original, String desc) { 262 FunctionElement resynthesized, FunctionElement original, String desc) {
261 compareExecutableElements(resynthesized, original, desc); 263 compareExecutableElements(resynthesized, original, desc);
262 } 264 }
263 265
264 void compareFunctionTypeAliasElements( 266 void compareFunctionTypeAliasElements(
265 FunctionTypeAliasElementImpl resynthesized, 267 FunctionTypeAliasElementImpl resynthesized,
266 FunctionTypeAliasElementImpl original, 268 FunctionTypeAliasElementImpl original,
267 String desc) { 269 String desc) {
268 compareElements(resynthesized, original, desc); 270 compareElements(resynthesized, original, desc);
269 expect(resynthesized.parameters.length, original.parameters.length); 271 expect(resynthesized.parameters.length, original.parameters.length);
270 for (int i = 0; i < resynthesized.parameters.length; i++) { 272 for (int i = 0; i < resynthesized.parameters.length; i++) {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 550
549 fail_variable_propagatedType_final_dep_inPart() { 551 fail_variable_propagatedType_final_dep_inPart() {
550 addNamedSource('/a.dart', 'part of lib; final a = 1;'); 552 addNamedSource('/a.dart', 'part of lib; final a = 1;');
551 checkLibrary('library lib; part "a.dart"; final b = a / 2;'); 553 checkLibrary('library lib; part "a.dart"; final b = a / 2;');
552 } 554 }
553 555
554 fail_variable_propagatedType_final_noDep() { 556 fail_variable_propagatedType_final_noDep() {
555 checkLibrary('final i = 0;'); 557 checkLibrary('final i = 0;');
556 } 558 }
557 559
560 ElementImpl getActualElement(Element element, String desc) {
561 if (element is ElementHandle) {
562 return element.actualElement;
563 } else if (element is ElementImpl) {
564 return element;
565 } else {
566 fail('Unexpected type for resynthesized ($desc):'
567 ' ${element.runtimeType}');
568 return null;
569 }
570 }
571
558 LibraryElementImpl resynthesizeLibrary( 572 LibraryElementImpl resynthesizeLibrary(
559 Source source, LibraryElementImpl original, bool allowErrors, 573 Source source, LibraryElementImpl original, bool allowErrors) {
560 {int resynthesisCount: 1}) {
561 if (!allowErrors) { 574 if (!allowErrors) {
562 assertNoErrors(source); 575 assertNoErrors(source);
563 } 576 }
564 String uri = source.uri.toString(); 577 String uri = source.uri.toString();
565 addLibrary('dart:core'); 578 addLibrary('dart:core');
566 return resynthesizeLibraryElement(uri, original, 579 return resynthesizeLibraryElement(uri, original);
567 resynthesisCount: resynthesisCount);
568 } 580 }
569 581
570 LibraryElementImpl resynthesizeLibraryElement( 582 LibraryElementImpl resynthesizeLibraryElement(
571 String uri, LibraryElementImpl original, 583 String uri, LibraryElementImpl original) {
572 {int resynthesisCount: 1}) {
573 Map<String, UnlinkedUnit> unlinkedSummaries = <String, UnlinkedUnit>{}; 584 Map<String, UnlinkedUnit> unlinkedSummaries = <String, UnlinkedUnit>{};
574 PrelinkedLibrary getPrelinkedSummaryFor(LibraryElement lib) { 585 PrelinkedLibrary getPrelinkedSummaryFor(LibraryElement lib) {
575 LibrarySerializationResult serialized = 586 LibrarySerializationResult serialized =
576 serializeLibrary(lib, typeProvider); 587 serializeLibrary(lib, typeProvider);
577 for (int i = 0; i < serialized.unlinkedUnits.length; i++) { 588 for (int i = 0; i < serialized.unlinkedUnits.length; i++) {
578 unlinkedSummaries[serialized.unitUris[i]] = 589 unlinkedSummaries[serialized.unitUris[i]] =
579 new UnlinkedUnit.fromBuffer(serialized.unlinkedUnits[i].toBuffer()); 590 new UnlinkedUnit.fromBuffer(serialized.unlinkedUnits[i].toBuffer());
580 } 591 }
581 return new PrelinkedLibrary.fromBuffer(serialized.prelinked.toBuffer()); 592 return new PrelinkedLibrary.fromBuffer(serialized.prelinked.toBuffer());
582 } 593 }
(...skipping 20 matching lines...) Expand all
603 } 614 }
604 SummaryResynthesizer resynthesizer = new SummaryResynthesizer( 615 SummaryResynthesizer resynthesizer = new SummaryResynthesizer(
605 analysisContext, 616 analysisContext,
606 analysisContext.typeProvider, 617 analysisContext.typeProvider,
607 getPrelinkedSummary, 618 getPrelinkedSummary,
608 getUnlinkedSummary, 619 getUnlinkedSummary,
609 analysisContext.sourceFactory); 620 analysisContext.sourceFactory);
610 LibraryElementImpl resynthesized = resynthesizer.getLibraryElement(uri); 621 LibraryElementImpl resynthesized = resynthesizer.getLibraryElement(uri);
611 // Check that no other summaries needed to be resynthesized to resynthesize 622 // Check that no other summaries needed to be resynthesized to resynthesize
612 // the library element. 623 // the library element.
613 // TODO(paulberry): once export namespaces are resynthesized from 624 expect(resynthesizer.resynthesisCount, 1);
614 // prelinked data, resynthesisCount should be hardcoded to 1.
615 expect(resynthesizer.resynthesisCount, resynthesisCount);
616 return resynthesized; 625 return resynthesized;
617 } 626 }
618 627
619 test_class_alias() { 628 test_class_alias() {
620 checkLibrary('class C = D with E, F; class D {} class E {} class F {}'); 629 checkLibrary('class C = D with E, F; class D {} class E {} class F {}');
621 } 630 }
622 631
623 test_class_alias_documented() { 632 test_class_alias_documented() {
624 checkLibrary(''' 633 checkLibrary('''
625 // Extra comment so doc comment offset != 0 634 // Extra comment so doc comment offset != 0
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 } 946 }
938 947
939 test_enum_values() { 948 test_enum_values() {
940 checkLibrary('enum E { v1, v2 }'); 949 checkLibrary('enum E { v1, v2 }');
941 } 950 }
942 951
943 test_enums() { 952 test_enums() {
944 checkLibrary('enum E1 { v1 } enum E2 { v2 }'); 953 checkLibrary('enum E1 { v1 } enum E2 { v2 }');
945 } 954 }
946 955
956 test_export_class() {
957 addLibrarySource('/a.dart', 'class C {}');
958 checkLibrary('export "a.dart";');
959 }
960
961 test_export_class_type_alias() {
962 addLibrarySource(
963 '/a.dart', 'class C {} exends _D with _E; class _D {} class _E {}');
964 checkLibrary('export "a.dart";');
965 }
966
967 test_export_function() {
968 addLibrarySource('/a.dart', 'f() {}');
969 checkLibrary('export "a.dart";');
970 }
971
972 test_export_getter() {
973 addLibrarySource('/a.dart', 'get f() => null;');
974 checkLibrary('export "a.dart";');
975 }
976
947 test_export_hide() { 977 test_export_hide() {
948 addLibrary('dart:async'); 978 addLibrary('dart:async');
949 checkLibrary('export "dart:async" hide Stream, Future;', 979 checkLibrary('export "dart:async" hide Stream, Future;');
950 resynthesisCount: 2);
951 } 980 }
952 981
953 test_export_multiple_combinators() { 982 test_export_multiple_combinators() {
954 addLibrary('dart:async'); 983 addLibrary('dart:async');
955 checkLibrary('export "dart:async" hide Stream show Future;', 984 checkLibrary('export "dart:async" hide Stream show Future;');
956 resynthesisCount: 2); 985 }
986
987 test_export_setter() {
988 addLibrarySource('/a.dart', 'void set f(value) {}');
989 checkLibrary('export "a.dart";');
957 } 990 }
958 991
959 test_export_show() { 992 test_export_show() {
960 addLibrary('dart:async'); 993 addLibrary('dart:async');
961 checkLibrary('export "dart:async" show Future, Stream;', 994 checkLibrary('export "dart:async" show Future, Stream;');
962 resynthesisCount: 2); 995 }
996
997 test_export_typedef() {
998 addLibrarySource('/a.dart', 'typedef F();');
999 checkLibrary('export "a.dart";');
1000 }
1001
1002 test_export_variable() {
1003 addLibrarySource('/a.dart', 'var x;');
1004 checkLibrary('export "a.dart";');
1005 }
1006
1007 test_export_variable_const() {
1008 addLibrarySource('/a.dart', 'const x = 0;');
1009 checkLibrary('export "a.dart";');
1010 }
1011
1012 test_export_variable_final() {
1013 addLibrarySource('/a.dart', 'final x = 0;');
1014 checkLibrary('export "a.dart";');
963 } 1015 }
964 1016
965 test_exports() { 1017 test_exports() {
966 addLibrarySource('/a.dart', 'library a;'); 1018 addLibrarySource('/a.dart', 'library a;');
967 addLibrarySource('/b.dart', 'library b;'); 1019 addLibrarySource('/b.dart', 'library b;');
968 checkLibrary('export "a.dart"; export "b.dart";', resynthesisCount: 3); 1020 checkLibrary('export "a.dart"; export "b.dart";');
969 } 1021 }
970 1022
971 test_field_documented() { 1023 test_field_documented() {
972 checkLibrary(''' 1024 checkLibrary('''
973 class C { 1025 class C {
974 /** 1026 /**
975 * Docs 1027 * Docs
976 */ 1028 */
977 var x; 1029 var x;
978 }'''); 1030 }''');
979 } 1031 }
980 1032
981 test_function_documented() { 1033 test_function_documented() {
982 checkLibrary(''' 1034 checkLibrary('''
983 // Extra comment so doc comment offset != 0 1035 // Extra comment so doc comment offset != 0
984 /** 1036 /**
985 * Docs 1037 * Docs
986 */ 1038 */
987 f() {}'''); 1039 f() {}''');
988 } 1040 }
989 1041
990 test_function_entry_point() { 1042 test_function_entry_point() {
991 checkLibrary('main() {}'); 1043 checkLibrary('main() {}');
992 } 1044 }
993 1045
994 test_function_entry_point_in_export() { 1046 test_function_entry_point_in_export() {
995 addLibrarySource('/a.dart', 'library a; main() {}'); 1047 addLibrarySource('/a.dart', 'library a; main() {}');
996 checkLibrary('export "a.dart";', resynthesisCount: 2); 1048 checkLibrary('export "a.dart";');
997 } 1049 }
998 1050
999 test_function_entry_point_in_export_hidden() { 1051 test_function_entry_point_in_export_hidden() {
1000 addLibrarySource('/a.dart', 'library a; main() {}'); 1052 addLibrarySource('/a.dart', 'library a; main() {}');
1001 checkLibrary('export "a.dart" hide main;', resynthesisCount: 2); 1053 checkLibrary('export "a.dart" hide main;');
1002 } 1054 }
1003 1055
1004 test_function_entry_point_in_part() { 1056 test_function_entry_point_in_part() {
1005 addNamedSource('/a.dart', 'part of my.lib; main() {}'); 1057 addNamedSource('/a.dart', 'part of my.lib; main() {}');
1006 checkLibrary('library my.lib; part "a.dart";'); 1058 checkLibrary('library my.lib; part "a.dart";');
1007 } 1059 }
1008 1060
1009 test_function_external() { 1061 test_function_external() {
1010 checkLibrary('external f();'); 1062 checkLibrary('external f();');
1011 } 1063 }
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 } 1192 }
1141 1193
1142 test_library_name_with_spaces() { 1194 test_library_name_with_spaces() {
1143 checkLibrary('library foo . bar ;'); 1195 checkLibrary('library foo . bar ;');
1144 } 1196 }
1145 1197
1146 test_library_named() { 1198 test_library_named() {
1147 checkLibrary('library foo.bar;'); 1199 checkLibrary('library foo.bar;');
1148 } 1200 }
1149 1201
1202 test_main_class() {
1203 checkLibrary('class main {}');
1204 }
1205
1206 test_main_class_alias() {
1207 checkLibrary('class main = C with D; class C {} class D {}');
1208 }
1209
1210 test_main_class_alias_via_export() {
1211 addLibrarySource('/a.dart', 'class main = C with D; class C {} class D {}');
1212 checkLibrary('export "a.dart";');
1213 }
1214
1215 test_main_class_via_export() {
1216 addLibrarySource('/a.dart', 'class main {}');
1217 checkLibrary('export "a.dart";');
1218 }
1219
1220 test_main_getter() {
1221 checkLibrary('get main => null;');
1222 }
1223
1224 test_main_getter_via_export() {
1225 addLibrarySource('/a.dart', 'get main => null;');
1226 checkLibrary('export "a.dart";');
1227 }
1228
1229 test_main_typedef() {
1230 checkLibrary('typedef main();');
1231 }
1232
1233 test_main_typedef_via_export() {
1234 addLibrarySource('/a.dart', 'typedef main();');
1235 checkLibrary('export "a.dart";');
1236 }
1237
1238 test_main_variable() {
1239 checkLibrary('var main;');
1240 }
1241
1242 test_main_variable_via_export() {
1243 addLibrarySource('/a.dart', 'var main;');
1244 checkLibrary('export "a.dart";');
1245 }
1246
1150 test_method_documented() { 1247 test_method_documented() {
1151 checkLibrary(''' 1248 checkLibrary('''
1152 class C { 1249 class C {
1153 /** 1250 /**
1154 * Docs 1251 * Docs
1155 */ 1252 */
1156 f() {} 1253 f() {}
1157 }'''); 1254 }''');
1158 } 1255 }
1159 1256
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 test_variable_setterInPart_getterInPart() { 1579 test_variable_setterInPart_getterInPart() {
1483 addNamedSource('/a.dart', 'part of my.lib; void set x(int _) {}'); 1580 addNamedSource('/a.dart', 'part of my.lib; void set x(int _) {}');
1484 addNamedSource('/b.dart', 'part of my.lib; int get x => 42;'); 1581 addNamedSource('/b.dart', 'part of my.lib; int get x => 42;');
1485 checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); 1582 checkLibrary('library my.lib; part "a.dart"; part "b.dart";');
1486 } 1583 }
1487 1584
1488 test_variables() { 1585 test_variables() {
1489 checkLibrary('int i; int j;'); 1586 checkLibrary('int i; int j;');
1490 } 1587 }
1491 } 1588 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698