Chromium Code Reviews| 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 engine.incremental_resolver_test; | 5 library engine.incremental_resolver_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
| 9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/error.dart'; | 10 import 'package:analyzer/src/generated/error.dart'; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 } | 63 } |
| 64 | 64 |
| 65 | 65 |
| 66 @ReflectiveTestCase() | 66 @ReflectiveTestCase() |
| 67 class DeclarationMatcherTest extends ResolverTestCase { | 67 class DeclarationMatcherTest extends ResolverTestCase { |
| 68 void setUp() { | 68 void setUp() { |
| 69 super.setUp(); | 69 super.setUp(); |
| 70 test_resolveApiChanges = true; | 70 test_resolveApiChanges = true; |
| 71 } | 71 } |
| 72 | 72 |
| 73 void test_false_class_annotation_edit() { | |
|
Brian Wilkerson
2015/01/12 17:46:57
Might be good to add a positive test (that if it h
| |
| 74 _assertDoesNotMatch(r''' | |
| 75 const my_annotationA = const Object(); | |
| 76 const my_annotationB = const Object(); | |
| 77 @my_annotationA | |
| 78 class A { | |
| 79 } | |
| 80 ''', r''' | |
| 81 const my_annotationA = const Object(); | |
| 82 const my_annotationB = const Object(); | |
| 83 @my_annotationB | |
| 84 class A { | |
| 85 } | |
| 86 '''); | |
| 87 } | |
| 88 | |
| 89 void test_false_class_annotations_add() { | |
| 90 _assertDoesNotMatch(r''' | |
| 91 const my_annotation = const Object(); | |
| 92 class A { | |
| 93 } | |
| 94 ''', r''' | |
| 95 const my_annotation = const Object(); | |
| 96 @my_annotation | |
| 97 class A { | |
| 98 } | |
| 99 '''); | |
| 100 } | |
| 101 | |
| 102 void test_false_class_annotations_remove() { | |
| 103 _assertDoesNotMatch(r''' | |
| 104 const my_annotation = const Object(); | |
| 105 @my_annotation | |
| 106 class A { | |
| 107 } | |
| 108 ''', r''' | |
| 109 const my_annotation = const Object(); | |
| 110 class A { | |
| 111 } | |
| 112 '''); | |
| 113 } | |
| 114 | |
| 73 void test_false_class_list_add() { | 115 void test_false_class_list_add() { |
| 74 _assertDoesNotMatch(r''' | 116 _assertDoesNotMatch(r''' |
| 75 class A {} | 117 class A {} |
| 76 class B {} | 118 class B {} |
| 77 ''', r''' | 119 ''', r''' |
| 78 class A {} | 120 class A {} |
| 79 class B {} | 121 class B {} |
| 80 class C {} | 122 class C {} |
| 81 '''); | 123 '''); |
| 82 } | 124 } |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 804 } | 846 } |
| 805 | 847 |
| 806 void test_false_import_show_remove() { | 848 void test_false_import_show_remove() { |
| 807 _assertDoesNotMatch(r''' | 849 _assertDoesNotMatch(r''' |
| 808 import 'dart:async' show Future, Stream; | 850 import 'dart:async' show Future, Stream; |
| 809 ''', r''' | 851 ''', r''' |
| 810 import 'dart:async' show Future; | 852 import 'dart:async' show Future; |
| 811 '''); | 853 '''); |
| 812 } | 854 } |
| 813 | 855 |
| 856 void test_false_method_annotation_edit() { | |
| 857 _assertDoesNotMatchOK(r''' | |
| 858 const my_annotationA = const Object(); | |
| 859 const my_annotationB = const Object(); | |
| 860 class A { | |
| 861 @my_annotationA | |
| 862 void m() {} | |
| 863 } | |
| 864 ''', r''' | |
| 865 const my_annotationA = const Object(); | |
| 866 const my_annotationB = const Object(); | |
| 867 class A { | |
| 868 @my_annotationB | |
| 869 void m() {} | |
| 870 } | |
| 871 '''); | |
| 872 } | |
| 873 | |
| 874 void test_false_method_annotations_add() { | |
| 875 _assertDoesNotMatchOK(r''' | |
| 876 const my_annotation = const Object(); | |
| 877 class A { | |
| 878 void m() {} | |
| 879 } | |
| 880 ''', r''' | |
| 881 const my_annotation = const Object(); | |
| 882 class A { | |
| 883 @my_annotation | |
| 884 void m() {} | |
| 885 } | |
| 886 '''); | |
| 887 } | |
| 888 | |
| 889 void test_false_method_annotations_remove() { | |
| 890 _assertDoesNotMatchOK(r''' | |
| 891 const my_annotation = const Object(); | |
| 892 class A { | |
| 893 @my_annotation | |
| 894 void m() {} | |
| 895 } | |
| 896 ''', r''' | |
| 897 const my_annotation = const Object(); | |
| 898 class A { | |
| 899 void m() {} | |
| 900 } | |
| 901 '''); | |
| 902 } | |
| 903 | |
| 814 void test_false_method_list_add() { | 904 void test_false_method_list_add() { |
| 815 _assertDoesNotMatchOK(r''' | 905 _assertDoesNotMatchOK(r''' |
| 816 class A { | 906 class A { |
| 817 a() {} | 907 a() {} |
| 818 b() {} | 908 b() {} |
| 819 } | 909 } |
| 820 ''', r''' | 910 ''', r''' |
| 821 class A { | 911 class A { |
| 822 a() {} | 912 a() {} |
| 823 b() {} | 913 b() {} |
| (...skipping 2578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3402 } | 3492 } |
| 3403 } | 3493 } |
| 3404 | 3494 |
| 3405 | 3495 |
| 3406 class _Edit { | 3496 class _Edit { |
| 3407 final int offset; | 3497 final int offset; |
| 3408 final int length; | 3498 final int length; |
| 3409 final String replacement; | 3499 final String replacement; |
| 3410 _Edit(this.offset, this.length, this.replacement); | 3500 _Edit(this.offset, this.length, this.replacement); |
| 3411 } | 3501 } |
| OLD | NEW |