| 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.highlights2; | 5 library test.analysis.notification.highlights2; |
| 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 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 p; | 904 p; |
| 905 p = 42; | 905 p = 42; |
| 906 } | 906 } |
| 907 '''); | 907 '''); |
| 908 await prepareHighlights(); | 908 await prepareHighlights(); |
| 909 assertHasRegion(HighlightRegionType.PARAMETER_DECLARATION, 'p) {'); | 909 assertHasRegion(HighlightRegionType.PARAMETER_DECLARATION, 'p) {'); |
| 910 assertHasRegion(HighlightRegionType.PARAMETER_REFERENCE, 'p;'); | 910 assertHasRegion(HighlightRegionType.PARAMETER_REFERENCE, 'p;'); |
| 911 assertHasRegion(HighlightRegionType.PARAMETER_REFERENCE, 'p = 42'); | 911 assertHasRegion(HighlightRegionType.PARAMETER_REFERENCE, 'p = 42'); |
| 912 } | 912 } |
| 913 | 913 |
| 914 test_PARAMETER_named() async { |
| 915 addTestFile(''' |
| 916 class C { |
| 917 final int aaa; |
| 918 C({this.aaa, int bbb}); |
| 919 } |
| 920 main() { |
| 921 new C(aaa: 1, bbb: 2); |
| 922 } |
| 923 '''); |
| 924 await prepareHighlights(); |
| 925 assertHasRegion(HighlightRegionType.INSTANCE_FIELD_REFERENCE, 'aaa,'); |
| 926 assertHasRegion(HighlightRegionType.PARAMETER_DECLARATION, 'bbb}'); |
| 927 assertHasRegion(HighlightRegionType.PARAMETER_REFERENCE, 'aaa: 1'); |
| 928 assertHasRegion(HighlightRegionType.PARAMETER_REFERENCE, 'bbb: 2'); |
| 929 } |
| 930 |
| 914 test_SETTER_DECLARATION() async { | 931 test_SETTER_DECLARATION() async { |
| 915 addTestFile(''' | 932 addTestFile(''' |
| 916 set aaa(x) {} | 933 set aaa(x) {} |
| 917 class A { | 934 class A { |
| 918 set bbb(x) {} | 935 set bbb(x) {} |
| 919 static set ccc(x) {} | 936 static set ccc(x) {} |
| 920 } | 937 } |
| 921 main(A a) { | 938 main(A a) { |
| 922 aaa = 1; | 939 aaa = 1; |
| 923 a.bbb = 2; | 940 a.bbb = 2; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1084 void test_toString() { | 1101 void test_toString() { |
| 1085 expect(HighlightRegionType.CLASS.toString(), 'HighlightRegionType.CLASS'); | 1102 expect(HighlightRegionType.CLASS.toString(), 'HighlightRegionType.CLASS'); |
| 1086 } | 1103 } |
| 1087 | 1104 |
| 1088 void test_valueOf_unknown() { | 1105 void test_valueOf_unknown() { |
| 1089 expect(() { | 1106 expect(() { |
| 1090 new HighlightRegionType('no-such-type'); | 1107 new HighlightRegionType('no-such-type'); |
| 1091 }, throws); | 1108 }, throws); |
| 1092 } | 1109 } |
| 1093 } | 1110 } |
| OLD | NEW |