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

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

Issue 1531913002: Add UnlinkedClass.hasNoSupertype property to summaries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
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 analyzer.test.src.summary.summary_test; 5 library analyzer.test.src.summary.summary_test;
6 6
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/src/generated/engine.dart'; 8 import 'package:analyzer/src/generated/engine.dart';
9 import 'package:analyzer/src/generated/java_engine_io.dart'; 9 import 'package:analyzer/src/generated/java_engine_io.dart';
10 import 'package:analyzer/src/generated/source.dart'; 10 import 'package:analyzer/src/generated/source.dart';
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 void setUp() { 69 void setUp() {
70 super.setUp(); 70 super.setUp();
71 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); 71 AnalysisOptionsImpl options = new AnalysisOptionsImpl();
72 options.enableGenericMethods = true; 72 options.enableGenericMethods = true;
73 resetWithOptions(options); 73 resetWithOptions(options);
74 } 74 }
75 75
76 test_class_no_superclass() { 76 test_class_no_superclass() {
77 UnlinkedClass cls = serializeClassElement(typeProvider.objectType.element); 77 UnlinkedClass cls = serializeClassElement(typeProvider.objectType.element);
78 expect(cls.supertype, isNull); 78 expect(cls.supertype, isNull);
79 expect(cls.hasNoSupertype, isTrue);
79 } 80 }
80 } 81 }
81 82
82 /** 83 /**
83 * Base class containing most summary tests. This allows summary tests to be 84 * Base class containing most summary tests. This allows summary tests to be
84 * re-used to exercise all the different ways in which summaries can be 85 * re-used to exercise all the different ways in which summaries can be
85 * generated (e.g. direct from the AST, from the element model, from a 86 * generated (e.g. direct from the AST, from the element model, from a
86 * "relinking" process, etc.) 87 * "relinking" process, etc.)
87 */ 88 */
88 abstract class SummaryTest { 89 abstract class SummaryTest {
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 } 658 }
658 class E {} 659 class E {}
659 '''); 660 ''');
660 expect(cls.executables, isEmpty); 661 expect(cls.executables, isEmpty);
661 } 662 }
662 663
663 test_class_alias_supertype() { 664 test_class_alias_supertype() {
664 UnlinkedClass cls = 665 UnlinkedClass cls =
665 serializeClassText('class C = D with E; class D {} class E {}'); 666 serializeClassText('class C = D with E; class D {} class E {}');
666 checkTypeRef(cls.supertype, null, null, 'D'); 667 checkTypeRef(cls.supertype, null, null, 'D');
668 expect(cls.hasNoSupertype, isFalse);
667 } 669 }
668 670
669 test_class_concrete() { 671 test_class_concrete() {
670 UnlinkedClass cls = serializeClassText('class C {}'); 672 UnlinkedClass cls = serializeClassText('class C {}');
671 expect(cls.isAbstract, false); 673 expect(cls.isAbstract, false);
672 } 674 }
673 675
674 test_class_interface() { 676 test_class_interface() {
675 UnlinkedClass cls = serializeClassText(''' 677 UnlinkedClass cls = serializeClassText('''
676 class C implements D {} 678 class C implements D {}
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 } 741 }
740 742
741 test_class_non_alias_flag() { 743 test_class_non_alias_flag() {
742 UnlinkedClass cls = serializeClassText('class C {}'); 744 UnlinkedClass cls = serializeClassText('class C {}');
743 expect(cls.isMixinApplication, false); 745 expect(cls.isMixinApplication, false);
744 } 746 }
745 747
746 test_class_superclass() { 748 test_class_superclass() {
747 UnlinkedClass cls = serializeClassText('class C {}'); 749 UnlinkedClass cls = serializeClassText('class C {}');
748 expect(cls.supertype, isNull); 750 expect(cls.supertype, isNull);
751 expect(cls.hasNoSupertype, isFalse);
749 } 752 }
750 753
751 test_class_superclass_explicit() { 754 test_class_superclass_explicit() {
752 UnlinkedClass cls = serializeClassText('class C extends D {} class D {}'); 755 UnlinkedClass cls = serializeClassText('class C extends D {} class D {}');
753 expect(cls.supertype, isNotNull); 756 expect(cls.supertype, isNotNull);
754 checkTypeRef(cls.supertype, null, null, 'D'); 757 checkTypeRef(cls.supertype, null, null, 'D');
758 expect(cls.hasNoSupertype, isFalse);
755 } 759 }
756 760
757 test_class_type_param_bound() { 761 test_class_type_param_bound() {
758 UnlinkedClass cls = serializeClassText('class C<T extends List> {}'); 762 UnlinkedClass cls = serializeClassText('class C<T extends List> {}');
759 expect(cls.typeParameters, hasLength(1)); 763 expect(cls.typeParameters, hasLength(1));
760 expect(cls.typeParameters[0].name, 'T'); 764 expect(cls.typeParameters[0].name, 'T');
761 expect(cls.typeParameters[0].bound, isNotNull); 765 expect(cls.typeParameters[0].bound, isNotNull);
762 checkTypeRef(cls.typeParameters[0].bound, 'dart:core', 'dart:core', 'List', 766 checkTypeRef(cls.typeParameters[0].bound, 'dart:core', 'dart:core', 'List',
763 allowTypeParameters: true); 767 allowTypeParameters: true);
764 } 768 }
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
2125 serializeClassText('class C { static int i; }').fields[0]; 2129 serializeClassText('class C { static int i; }').fields[0];
2126 expect(variable.isStatic, isTrue); 2130 expect(variable.isStatic, isTrue);
2127 } 2131 }
2128 2132
2129 test_variable_type() { 2133 test_variable_type() {
2130 UnlinkedVariable variable = 2134 UnlinkedVariable variable =
2131 serializeVariableText('int i;', variableName: 'i'); 2135 serializeVariableText('int i;', variableName: 'i');
2132 checkTypeRef(variable.type, 'dart:core', 'dart:core', 'int'); 2136 checkTypeRef(variable.type, 'dart:core', 'dart:core', 'int');
2133 } 2137 }
2134 } 2138 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_elements.dart ('k') | pkg/analyzer/tool/summary/idl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698