OLD | NEW |
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.navigation; | 5 library test.analysis.notification.navigation; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
10 import 'package:analysis_server/src/constants.dart'; | 10 import 'package:analysis_server/src/constants.dart'; |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 test_partOf() { | 790 test_partOf() { |
791 var libCode = 'library lib; part "test.dart";'; | 791 var libCode = 'library lib; part "test.dart";'; |
792 var libFile = addFile('$projectPath/bin/lib.dart', libCode); | 792 var libFile = addFile('$projectPath/bin/lib.dart', libCode); |
793 addTestFile('part of lib;'); | 793 addTestFile('part of lib;'); |
794 return prepareNavigation().then((_) { | 794 return prepareNavigation().then((_) { |
795 assertHasRegionString('lib'); | 795 assertHasRegionString('lib'); |
796 assertHasFileTarget(libFile, libCode.indexOf('lib;'), 'lib'.length); | 796 assertHasFileTarget(libFile, libCode.indexOf('lib;'), 'lib'.length); |
797 }); | 797 }); |
798 } | 798 } |
799 | 799 |
| 800 test_redirectingConstructorInvocation() { |
| 801 addTestFile(''' |
| 802 class A { |
| 803 A() {} |
| 804 A.foo() : this(); |
| 805 A.bar() : this.foo(); |
| 806 } |
| 807 '''); |
| 808 return prepareNavigation().then((_) { |
| 809 { |
| 810 assertHasRegion('this();'); |
| 811 assertHasTarget('A() {}', 0); |
| 812 } |
| 813 { |
| 814 assertHasRegion('this.foo'); |
| 815 assertHasTarget('foo() :'); |
| 816 } |
| 817 { |
| 818 assertHasRegion('foo();'); |
| 819 assertHasTarget('foo() :'); |
| 820 } |
| 821 }); |
| 822 } |
| 823 |
800 test_string_export() { | 824 test_string_export() { |
801 var libCode = 'library lib;'; | 825 var libCode = 'library lib;'; |
802 var libFile = addFile('$projectPath/bin/lib.dart', libCode); | 826 var libFile = addFile('$projectPath/bin/lib.dart', libCode); |
803 addTestFile('export "lib.dart";'); | 827 addTestFile('export "lib.dart";'); |
804 return prepareNavigation().then((_) { | 828 return prepareNavigation().then((_) { |
805 assertHasRegionString('"lib.dart"'); | 829 assertHasRegionString('"lib.dart"'); |
806 assertHasFileTarget(libFile, libCode.indexOf('lib;'), 'lib'.length); | 830 assertHasFileTarget(libFile, libCode.indexOf('lib;'), 'lib'.length); |
807 }); | 831 }); |
808 } | 832 } |
809 | 833 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 B() : super(); | 895 B() : super(); |
872 B.named() : super.named(); | 896 B.named() : super.named(); |
873 } | 897 } |
874 '''); | 898 '''); |
875 return prepareNavigation().then((_) { | 899 return prepareNavigation().then((_) { |
876 { | 900 { |
877 assertHasRegionString('super'); | 901 assertHasRegionString('super'); |
878 assertHasTarget('A() {}', 0); | 902 assertHasTarget('A() {}', 0); |
879 } | 903 } |
880 { | 904 { |
881 assertHasRegionString('super.named'); | 905 assertHasRegion('super.named'); |
| 906 assertHasTarget('named() {}'); |
| 907 } |
| 908 { |
| 909 assertHasRegion('named();'); |
882 assertHasTarget('named() {}'); | 910 assertHasTarget('named() {}'); |
883 } | 911 } |
884 }); | 912 }); |
885 } | 913 } |
886 | 914 |
887 test_superConstructorInvocation_synthetic() { | 915 test_superConstructorInvocation_synthetic() { |
888 addTestFile(''' | 916 addTestFile(''' |
889 class A { | 917 class A { |
890 } | 918 } |
891 class B extends A { | 919 class B extends A { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 test_type_void() { | 955 test_type_void() { |
928 addTestFile(''' | 956 addTestFile(''' |
929 void main() { | 957 void main() { |
930 } | 958 } |
931 '''); | 959 '''); |
932 return prepareNavigation().then((_) { | 960 return prepareNavigation().then((_) { |
933 assertNoRegionAt('void'); | 961 assertNoRegionAt('void'); |
934 }); | 962 }); |
935 } | 963 } |
936 } | 964 } |
OLD | NEW |