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/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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 assertHasRegion( | 724 assertHasRegion( |
725 HighlightRegionType.INSTANCE_FIELD_DECLARATION, 'aaa = 1'); | 725 HighlightRegionType.INSTANCE_FIELD_DECLARATION, 'aaa = 1'); |
726 assertHasRegion( | 726 assertHasRegion( |
727 HighlightRegionType.INSTANCE_FIELD_DECLARATION, 'bbb = 2'); | 727 HighlightRegionType.INSTANCE_FIELD_DECLARATION, 'bbb = 2'); |
728 assertHasRegion(HighlightRegionType.INSTANCE_FIELD_REFERENCE, 'bbb = 3'); | 728 assertHasRegion(HighlightRegionType.INSTANCE_FIELD_REFERENCE, 'bbb = 3'); |
729 assertHasRegion(HighlightRegionType.INSTANCE_SETTER_REFERENCE, 'aaa = 4'); | 729 assertHasRegion(HighlightRegionType.INSTANCE_SETTER_REFERENCE, 'aaa = 4'); |
730 assertHasRegion(HighlightRegionType.INSTANCE_SETTER_REFERENCE, 'bbb = 5'); | 730 assertHasRegion(HighlightRegionType.INSTANCE_SETTER_REFERENCE, 'bbb = 5'); |
731 }); | 731 }); |
732 } | 732 } |
733 | 733 |
| 734 test_INSTANCE_FIELD_dynamic() { |
| 735 addTestFile(''' |
| 736 class A { |
| 737 var f; |
| 738 A(this.f); |
| 739 } |
| 740 '''); |
| 741 return prepareHighlights().then((_) { |
| 742 assertHasRegion(HighlightRegionType.INSTANCE_FIELD_DECLARATION, 'f;'); |
| 743 assertHasRegion(HighlightRegionType.INSTANCE_FIELD_REFERENCE, 'f);'); |
| 744 }); |
| 745 } |
| 746 |
734 test_KEYWORD() { | 747 test_KEYWORD() { |
735 addTestFile(''' | 748 addTestFile(''' |
736 main() { | 749 main() { |
737 assert(true); | 750 assert(true); |
738 for (;;) break; | 751 for (;;) break; |
739 switch (0) { | 752 switch (0) { |
740 case 0: break; | 753 case 0: break; |
741 default: break; | 754 default: break; |
742 } | 755 } |
743 try {} catch (e) {} | 756 try {} catch (e) {} |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 void test_toString() { | 1095 void test_toString() { |
1083 expect(HighlightRegionType.CLASS.toString(), 'HighlightRegionType.CLASS'); | 1096 expect(HighlightRegionType.CLASS.toString(), 'HighlightRegionType.CLASS'); |
1084 } | 1097 } |
1085 | 1098 |
1086 void test_valueOf_unknown() { | 1099 void test_valueOf_unknown() { |
1087 expect(() { | 1100 expect(() { |
1088 new HighlightRegionType('no-such-type'); | 1101 new HighlightRegionType('no-such-type'); |
1089 }, throws); | 1102 }, throws); |
1090 } | 1103 } |
1091 } | 1104 } |
OLD | NEW |