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

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

Issue 1694873002: Add support for requesting units from resynthesizer. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 'dart:convert'; 7 import 'dart:convert';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 2517 matching lines...) Expand 10 before | Expand all | Expand 10 after
2528 test_getElement_setter() { 2528 test_getElement_setter() {
2529 PropertyAccessorElement original = 2529 PropertyAccessorElement original =
2530 resolve2(addSource('class C { void set f(value) {} }')) 2530 resolve2(addSource('class C { void set f(value) {} }'))
2531 .getType('C') 2531 .getType('C')
2532 .getSetter('f'); 2532 .getSetter('f');
2533 expect(original, isNotNull); 2533 expect(original, isNotNull);
2534 PropertyAccessorElement resynthesized = validateGetElement(original); 2534 PropertyAccessorElement resynthesized = validateGetElement(original);
2535 comparePropertyAccessorElements(resynthesized, original, 'C.setter f'); 2535 comparePropertyAccessorElements(resynthesized, original, 'C.setter f');
2536 } 2536 }
2537 2537
2538 test_getElement_unit() {
2539 Source source = addSource('class C { f() {} }');
2540 CompilationUnitElement original = resolve2(source).definingCompilationUnit;
2541 expect(original, isNotNull);
2542 CompilationUnitElement resynthesized = validateGetElement(original);
2543 compareCompilationUnitElements(resynthesized, original);
2544 }
2545
2538 test_getter_documented() { 2546 test_getter_documented() {
2539 checkLibrary(''' 2547 checkLibrary('''
2540 // Extra comment so doc comment offset != 0 2548 // Extra comment so doc comment offset != 0
2541 /** 2549 /**
2542 * Docs 2550 * Docs
2543 */ 2551 */
2544 get x => null;'''); 2552 get x => null;''');
2545 } 2553 }
2546 2554
2547 test_getter_external() { 2555 test_getter_external() {
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
3410 fail('Unexpectedly tried to get unlinked summary for $uri'); 3418 fail('Unexpectedly tried to get unlinked summary for $uri');
3411 } 3419 }
3412 return serializedUnit; 3420 return serializedUnit;
3413 } 3421 }
3414 3422
3415 @override 3423 @override
3416 bool hasLibrarySummary(String uri) { 3424 bool hasLibrarySummary(String uri) {
3417 return true; 3425 return true;
3418 } 3426 }
3419 } 3427 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698