| 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 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 } | 926 } |
| 927 | 927 |
| 928 test_type_void() async { | 928 test_type_void() async { |
| 929 addTestFile(''' | 929 addTestFile(''' |
| 930 void main() { | 930 void main() { |
| 931 } | 931 } |
| 932 '''); | 932 '''); |
| 933 await prepareNavigation(); | 933 await prepareNavigation(); |
| 934 assertNoRegionAt('void'); | 934 assertNoRegionAt('void'); |
| 935 } | 935 } |
| 936 |
| 937 test_var_declaredVariable() async { |
| 938 addTestFile(''' |
| 939 class C {} |
| 940 f(List<C> items) { |
| 941 for (var item in items) {} |
| 936 } | 942 } |
| 943 '''); |
| 944 await prepareNavigation(); |
| 945 assertHasRegionTarget('var', 'C {}'); |
| 946 expect(testTarget.kind, ElementKind.CLASS); |
| 947 } |
| 948 |
| 949 test_var_localVariable_multiple_inferred_different() async { |
| 950 addTestFile(''' |
| 951 class A {} |
| 952 class B {} |
| 953 void f() { |
| 954 var a = new A(), b = new B(); |
| 955 } |
| 956 '''); |
| 957 await prepareNavigation(); |
| 958 assertNoRegionAt('var'); |
| 959 } |
| 960 |
| 961 test_var_localVariable_multiple_inferred_same() async { |
| 962 addTestFile(''' |
| 963 class C {} |
| 964 void f() { |
| 965 var a = new C(), b = new C(); |
| 966 } |
| 967 '''); |
| 968 await prepareNavigation(); |
| 969 assertHasRegionTarget('var', 'C {}'); |
| 970 expect(testTarget.kind, ElementKind.CLASS); |
| 971 } |
| 972 |
| 973 test_var_localVariable_single_inferred() async { |
| 974 addTestFile(''' |
| 975 class C {} |
| 976 f() { |
| 977 var c = new C(); |
| 978 } |
| 979 '''); |
| 980 await prepareNavigation(); |
| 981 assertHasRegionTarget('var', 'C {}'); |
| 982 expect(testTarget.kind, ElementKind.CLASS); |
| 983 } |
| 984 |
| 985 test_var_localVariable_single_notInferred() async { |
| 986 addTestFile(''' |
| 987 f() { |
| 988 var x; |
| 989 } |
| 990 '''); |
| 991 await prepareNavigation(); |
| 992 assertNoRegionAt('var'); |
| 993 } |
| 994 |
| 995 test_var_topLevelVariable_multiple_inferred_different() async { |
| 996 addTestFile(''' |
| 997 class A {} |
| 998 class B {} |
| 999 var a = new A(), b = new B(); |
| 1000 '''); |
| 1001 await prepareNavigation(); |
| 1002 assertNoRegionAt('var'); |
| 1003 } |
| 1004 |
| 1005 test_var_topLevelVariable_multiple_inferred_same() async { |
| 1006 addTestFile(''' |
| 1007 class C {} |
| 1008 var a = new C(), b = new C(); |
| 1009 '''); |
| 1010 await prepareNavigation(); |
| 1011 assertHasRegionTarget('var', 'C {}'); |
| 1012 expect(testTarget.kind, ElementKind.CLASS); |
| 1013 } |
| 1014 |
| 1015 test_var_topLevelVariable_single_inferred() async { |
| 1016 addTestFile(''' |
| 1017 class C {} |
| 1018 var c = new C(); |
| 1019 '''); |
| 1020 await prepareNavigation(); |
| 1021 assertHasRegionTarget('var', 'C {}'); |
| 1022 expect(testTarget.kind, ElementKind.CLASS); |
| 1023 } |
| 1024 |
| 1025 test_var_topLevelVariable_single_notInferred() async { |
| 1026 addTestFile(''' |
| 1027 var x; |
| 1028 '''); |
| 1029 await prepareNavigation(); |
| 1030 assertNoRegionAt('var'); |
| 1031 } |
| 1032 } |
| OLD | NEW |