| 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.domain.analysis.notification.highlights; | 5 library test.domain.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'; |
| 11 import 'reflective_tests.dart'; | |
| 12 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
| 13 | 12 |
| 14 import 'analysis_abstract.dart'; | 13 import 'analysis_abstract.dart'; |
| 14 import 'reflective_tests.dart'; |
| 15 | 15 |
| 16 | 16 |
| 17 main() { | 17 main() { |
| 18 runReflectiveTests(AnalysisNotificationHighlightsTest); | 18 runReflectiveTests(AnalysisNotificationHighlightsTest); |
| 19 runReflectiveTests(HighlightTypeTest); | 19 runReflectiveTests(HighlightTypeTest); |
| 20 } | 20 } |
| 21 | 21 |
| 22 | 22 |
| 23 @ReflectiveTestCase() | 23 @ReflectiveTestCase() |
| 24 class AnalysisNotificationHighlightsTest extends AbstractAnalysisTest { | 24 class AnalysisNotificationHighlightsTest extends AbstractAnalysisTest { |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 test_KEYWORD_void() { | 699 test_KEYWORD_void() { |
| 700 addTestFile(''' | 700 addTestFile(''' |
| 701 void main() { | 701 void main() { |
| 702 } | 702 } |
| 703 '''); | 703 '''); |
| 704 return prepareHighlights().then((_) { | 704 return prepareHighlights().then((_) { |
| 705 assertHasRegion(HighlightRegionType.KEYWORD, 'void main()'); | 705 assertHasRegion(HighlightRegionType.KEYWORD, 'void main()'); |
| 706 }); | 706 }); |
| 707 } | 707 } |
| 708 | 708 |
| 709 test_LABEL() { |
| 710 addTestFile(''' |
| 711 main() { |
| 712 myLabel: |
| 713 while (true) { |
| 714 break myLabel; |
| 715 } |
| 716 } |
| 717 '''); |
| 718 return prepareHighlights().then((_) { |
| 719 assertHasRegion(HighlightRegionType.LABEL, 'myLabel:'); |
| 720 assertHasRegion(HighlightRegionType.LABEL, 'myLabel;'); |
| 721 }); |
| 722 } |
| 723 |
| 709 test_LITERAL_BOOLEAN() { | 724 test_LITERAL_BOOLEAN() { |
| 710 addTestFile('var V = true;'); | 725 addTestFile('var V = true;'); |
| 711 return prepareHighlights().then((_) { | 726 return prepareHighlights().then((_) { |
| 712 assertHasRegion(HighlightRegionType.LITERAL_BOOLEAN, 'true;'); | 727 assertHasRegion(HighlightRegionType.LITERAL_BOOLEAN, 'true;'); |
| 713 }); | 728 }); |
| 714 } | 729 } |
| 715 | 730 |
| 716 test_LITERAL_DOUBLE() { | 731 test_LITERAL_DOUBLE() { |
| 717 addTestFile('var V = 4.2;'); | 732 addTestFile('var V = 4.2;'); |
| 718 return prepareHighlights().then((_) { | 733 return prepareHighlights().then((_) { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 addFile('$testFolder/my_lib.dart', ''' | 898 addFile('$testFolder/my_lib.dart', ''' |
| 884 library lib; | 899 library lib; |
| 885 part 'test.dart'; | 900 part 'test.dart'; |
| 886 '''); | 901 '''); |
| 887 } | 902 } |
| 888 } | 903 } |
| 889 | 904 |
| 890 | 905 |
| 891 @ReflectiveTestCase() | 906 @ReflectiveTestCase() |
| 892 class HighlightTypeTest { | 907 class HighlightTypeTest { |
| 893 void test_toString() { | |
| 894 expect(HighlightRegionType.CLASS.toString(), 'HighlightRegionType.CLASS'); | |
| 895 } | |
| 896 | |
| 897 void test_constructor() { | 908 void test_constructor() { |
| 898 expect( | 909 expect( |
| 899 HighlightRegionType.CLASS, | 910 HighlightRegionType.CLASS, |
| 900 new HighlightRegionType(HighlightRegionType.CLASS.name)); | 911 new HighlightRegionType(HighlightRegionType.CLASS.name)); |
| 901 } | 912 } |
| 902 | 913 |
| 914 void test_toString() { |
| 915 expect(HighlightRegionType.CLASS.toString(), 'HighlightRegionType.CLASS'); |
| 916 } |
| 917 |
| 903 void test_valueOf_unknown() { | 918 void test_valueOf_unknown() { |
| 904 expect(() { | 919 expect(() { |
| 905 new HighlightRegionType('no-such-type'); | 920 new HighlightRegionType('no-such-type'); |
| 906 }, throws); | 921 }, throws); |
| 907 } | 922 } |
| 908 } | 923 } |
| OLD | NEW |