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

Side by Side Diff: pkg/analysis_server/test/analysis/notification_outline_test.dart

Issue 1325143003: Issue 24277. Use node's offset as the source range start for the first unit node in Outline. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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 | « pkg/analysis_server/lib/src/computer/computer_outline.dart ('k') | no next file » | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.analysis.notification.outline; 5 library test.analysis.notification.outline;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/constants.dart'; 9 import 'package:analysis_server/src/constants.dart';
10 import 'package:analysis_server/src/protocol.dart'; 10 import 'package:analysis_server/src/protocol.dart';
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 int end = testCode.indexOf(" // marker2"); 570 int end = testCode.indexOf(" // marker2");
571 expect(outline.offset, offset); 571 expect(outline.offset, offset);
572 expect(outline.length, end - offset); 572 expect(outline.length, end - offset);
573 } 573 }
574 } 574 }
575 }); 575 });
576 } 576 }
577 577
578 test_sourceRange_inUnit() { 578 test_sourceRange_inUnit() {
579 addTestFile(''' 579 addTestFile('''
580 library lib;
581 /// My first class.
580 class A { 582 class A {
581 } // endA 583 } // endA
582 class B { 584 class B {
583 } // endB 585 } // endB
584 '''); 586 ''');
585 return prepareOutline().then((_) { 587 return prepareOutline().then((_) {
586 Outline unitOutline = outline; 588 Outline unitOutline = outline;
587 List<Outline> topOutlines = unitOutline.children; 589 List<Outline> topOutlines = unitOutline.children;
588 expect(topOutlines, hasLength(2)); 590 expect(topOutlines, hasLength(2));
589 // A 591 // A
590 { 592 {
591 Outline outline = topOutlines[0]; 593 Outline outline = topOutlines[0];
592 Element element = outline.element; 594 Element element = outline.element;
593 expect(element.kind, ElementKind.CLASS); 595 expect(element.kind, ElementKind.CLASS);
594 expect(element.name, "A"); 596 expect(element.name, "A");
595 { 597 {
596 int offset = 0; 598 int offset = testCode.indexOf("/// My first class.");
597 int end = testCode.indexOf(" // endA"); 599 int end = testCode.indexOf(" // endA");
598 expect(outline.offset, offset); 600 expect(outline.offset, offset);
599 expect(outline.length, end - offset); 601 expect(outline.length, end - offset);
600 } 602 }
601 } 603 }
602 // B 604 // B
603 { 605 {
604 Outline outline = topOutlines[1]; 606 Outline outline = topOutlines[1];
605 Element element = outline.element; 607 Element element = outline.element;
606 expect(element.kind, ElementKind.CLASS); 608 expect(element.kind, ElementKind.CLASS);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 } 812 }
811 813
812 void _isEnumConstant(Outline outline, String name) { 814 void _isEnumConstant(Outline outline, String name) {
813 Element element = outline.element; 815 Element element = outline.element;
814 expect(element.kind, ElementKind.ENUM_CONSTANT); 816 expect(element.kind, ElementKind.ENUM_CONSTANT);
815 expect(element.name, name); 817 expect(element.name, name);
816 expect(element.parameters, isNull); 818 expect(element.parameters, isNull);
817 expect(element.returnType, isNull); 819 expect(element.returnType, isNull);
818 } 820 }
819 } 821 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/computer/computer_outline.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698