| 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.highlights; | 5 library test.analysis.notification.highlights; |
| 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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 } | 521 } |
| 522 '''); | 522 '''); |
| 523 return prepareHighlights().then((_) { | 523 return prepareHighlights().then((_) { |
| 524 assertHasRegion(HighlightRegionType.DYNAMIC_TYPE, 'p)'); | 524 assertHasRegion(HighlightRegionType.DYNAMIC_TYPE, 'p)'); |
| 525 assertHasRegion(HighlightRegionType.DYNAMIC_TYPE, 'v1 ='); | 525 assertHasRegion(HighlightRegionType.DYNAMIC_TYPE, 'v1 ='); |
| 526 assertNoRegion(HighlightRegionType.DYNAMIC_TYPE, 'v2;'); | 526 assertNoRegion(HighlightRegionType.DYNAMIC_TYPE, 'v2;'); |
| 527 assertNoRegion(HighlightRegionType.DYNAMIC_TYPE, 'v3 ='); | 527 assertNoRegion(HighlightRegionType.DYNAMIC_TYPE, 'v3 ='); |
| 528 }); | 528 }); |
| 529 } | 529 } |
| 530 | 530 |
| 531 test_ENUM() { |
| 532 addTestFile(''' |
| 533 enum MyEnum {A, B, C} |
| 534 MyEnum value; |
| 535 '''); |
| 536 return prepareHighlights().then((_) { |
| 537 assertHasRegion(HighlightRegionType.ENUM, 'MyEnum {'); |
| 538 assertHasRegion(HighlightRegionType.ENUM, 'MyEnum value;'); |
| 539 }); |
| 540 } |
| 541 |
| 542 test_ENUM_CONSTANT() { |
| 543 addTestFile(''' |
| 544 enum MyEnum {AAA, BBB} |
| 545 main() { |
| 546 print(MyEnum.AAA); |
| 547 print(MyEnum.BBB); |
| 548 } |
| 549 '''); |
| 550 return prepareHighlights().then((_) { |
| 551 assertHasRegion(HighlightRegionType.ENUM_CONSTANT, 'AAA, '); |
| 552 assertHasRegion(HighlightRegionType.ENUM_CONSTANT, 'BBB}'); |
| 553 assertHasRegion(HighlightRegionType.ENUM_CONSTANT, 'AAA);'); |
| 554 assertHasRegion(HighlightRegionType.ENUM_CONSTANT, 'BBB);'); |
| 555 }); |
| 556 } |
| 557 |
| 531 test_FIELD() { | 558 test_FIELD() { |
| 532 addTestFile(''' | 559 addTestFile(''' |
| 533 class A { | 560 class A { |
| 534 int aaa = 1; | 561 int aaa = 1; |
| 535 int bbb = 2; | 562 int bbb = 2; |
| 536 A([this.bbb = 3]); | 563 A([this.bbb = 3]); |
| 537 } | 564 } |
| 538 main(A a) { | 565 main(A a) { |
| 539 a.aaa = 4; | 566 a.aaa = 4; |
| 540 a.bbb = 5; | 567 a.bbb = 5; |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 void test_toString() { | 961 void test_toString() { |
| 935 expect(HighlightRegionType.CLASS.toString(), 'HighlightRegionType.CLASS'); | 962 expect(HighlightRegionType.CLASS.toString(), 'HighlightRegionType.CLASS'); |
| 936 } | 963 } |
| 937 | 964 |
| 938 void test_valueOf_unknown() { | 965 void test_valueOf_unknown() { |
| 939 expect(() { | 966 expect(() { |
| 940 new HighlightRegionType('no-such-type'); | 967 new HighlightRegionType('no-such-type'); |
| 941 }, throws); | 968 }, throws); |
| 942 } | 969 } |
| 943 } | 970 } |
| OLD | NEW |