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

Unified Diff: pkg/analyzer/test/src/summary/resynthesize_common.dart

Issue 3009533002: Move getElement() tests from AbstractResynthesizeTest mixin into AST resynthesizer tests. (Closed)
Patch Set: Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/src/summary/resynthesize_common.dart
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index b1d87056d25a93134598041a5739209547a528f1..7eea1b2e325224640bfb5174f7a19870e24b1841 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -1343,12 +1343,6 @@ abstract class ResynthesizeTest extends AbstractResynthesizeTest {
Future<LibraryElementImpl> checkLibrary(String text,
{bool allowErrors: false, bool dumpSummaries: false});
- /**
- * Return a [SummaryResynthesizer] to resynthesize the library with the
- * given [librarySource].
- */
- SummaryResynthesizer encodeDecodeLibrarySource(Source librarySource);
-
test_class_abstract() async {
var library = await checkLibrary('abstract class C {}');
checkElementText(library, r'''
@@ -6199,88 +6193,6 @@ int Function(int a, String b) v;
''');
}
- test_getElement_constructor_named() async {
- String text = 'class C { C.named(); }';
- Source source = addLibrarySource('/test.dart', text);
- ConstructorElement original = context
- .computeLibraryElement(source)
- .getType('C')
- .getNamedConstructor('named');
- expect(original, isNotNull);
- ConstructorElement resynthesized = validateGetElement(text, original);
- compareConstructorElements(resynthesized, original, 'C.constructor named');
- }
-
- test_getElement_constructor_unnamed() async {
- String text = 'class C { C(); }';
- Source source = addLibrarySource('/test.dart', text);
- ConstructorElement original =
- context.computeLibraryElement(source).getType('C').unnamedConstructor;
- expect(original, isNotNull);
- ConstructorElement resynthesized = validateGetElement(text, original);
- compareConstructorElements(resynthesized, original, 'C.constructor');
- }
-
- test_getElement_field() async {
- String text = 'class C { var f; }';
- Source source = addLibrarySource('/test.dart', text);
- FieldElement original =
- context.computeLibraryElement(source).getType('C').getField('f');
- expect(original, isNotNull);
- FieldElement resynthesized = validateGetElement(text, original);
- compareFieldElements(resynthesized, original, 'C.field f');
- }
-
- test_getElement_getter() async {
- String text = 'class C { get f => null; }';
- Source source = addLibrarySource('/test.dart', text);
- PropertyAccessorElement original =
- context.computeLibraryElement(source).getType('C').getGetter('f');
- expect(original, isNotNull);
- PropertyAccessorElement resynthesized = validateGetElement(text, original);
- comparePropertyAccessorElements(resynthesized, original, 'C.getter f');
- }
-
- test_getElement_method() async {
- String text = 'class C { f() {} }';
- Source source = addLibrarySource('/test.dart', text);
- MethodElement original =
- context.computeLibraryElement(source).getType('C').getMethod('f');
- expect(original, isNotNull);
- MethodElement resynthesized = validateGetElement(text, original);
- compareMethodElements(resynthesized, original, 'C.method f');
- }
-
- test_getElement_operator() async {
- String text = 'class C { operator+(x) => null; }';
- Source source = addLibrarySource('/test.dart', text);
- MethodElement original =
- context.computeLibraryElement(source).getType('C').getMethod('+');
- expect(original, isNotNull);
- MethodElement resynthesized = validateGetElement(text, original);
- compareMethodElements(resynthesized, original, 'C.operator+');
- }
-
- test_getElement_setter() async {
- String text = 'class C { void set f(value) {} }';
- Source source = addLibrarySource('/test.dart', text);
- PropertyAccessorElement original =
- context.computeLibraryElement(source).getType('C').getSetter('f');
- expect(original, isNotNull);
- PropertyAccessorElement resynthesized = validateGetElement(text, original);
- comparePropertyAccessorElements(resynthesized, original, 'C.setter f');
- }
-
- test_getElement_unit() async {
- String text = 'class C { f() {} }';
- Source source = addLibrarySource('/test.dart', text);
- CompilationUnitElement original =
- context.computeLibraryElement(source).definingCompilationUnit;
- expect(original, isNotNull);
- CompilationUnitElement resynthesized = validateGetElement(text, original);
- compareCompilationUnitElements(resynthesized, original);
- }
-
test_getter_documented() async {
var library = await checkLibrary('''
// Extra comment so doc comment offset != 0
@@ -10016,24 +9928,6 @@ int i;
int j;
''');
}
-
- /**
- * Encode the library containing [original] into a summary and then use
- * [TestSummaryResynthesizer.getElement] to retrieve just the original
- * element from the resynthesized summary.
- */
- Element validateGetElement(String text, Element original) {
- SummaryResynthesizer resynthesizer =
- encodeDecodeLibrarySource(original.library.source);
- ElementLocationImpl location = original.location;
- Element result = resynthesizer.getElement(location);
- checkMinimalResynthesisWork(resynthesizer, original.library);
- // Check that no other summaries needed to be resynthesized to resynthesize
- // the library element.
- expect(resynthesizer.resynthesisCount, 3);
- expect(result.location, location);
- return result;
- }
}
class TestSummaryResynthesizer extends SummaryResynthesizer {
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_ast_test.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698