| 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() { | 73 void test_false_class_annotation_accessor_edit() { |
| 74 _assertDoesNotMatch(r''' | 74 _assertDoesNotMatch(r''' |
| 75 const my_annotationA = const Object(); | 75 const my_annotationA = const Object(); |
| 76 const my_annotationB = const Object(); | 76 const my_annotationB = const Object(); |
| 77 @my_annotationA | 77 @my_annotationA |
| 78 class A { | 78 class A { |
| 79 } | 79 } |
| 80 ''', r''' | 80 ''', r''' |
| 81 const my_annotationA = const Object(); | 81 const my_annotationA = const Object(); |
| 82 const my_annotationB = const Object(); | 82 const my_annotationB = const Object(); |
| 83 @my_annotationB | 83 @my_annotationB |
| 84 class A { | 84 class A { |
| 85 } | 85 } |
| 86 '''); | 86 '''); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void test_false_class_annotation_constructor_edit() { |
| 90 _assertDoesNotMatch(r''' |
| 91 class MyAnnotationA { |
| 92 const MyAnnotationA(); |
| 93 } |
| 94 class MyAnnotationB { |
| 95 const MyAnnotationB(); |
| 96 } |
| 97 @MyAnnotationA() |
| 98 class A { |
| 99 } |
| 100 ''', r''' |
| 101 class MyAnnotationA { |
| 102 const MyAnnotationA(); |
| 103 } |
| 104 class MyAnnotationB { |
| 105 const MyAnnotationB(); |
| 106 } |
| 107 @MyAnnotationB() |
| 108 class A { |
| 109 } |
| 110 '''); |
| 111 } |
| 112 |
| 89 void test_false_class_annotations_add() { | 113 void test_false_class_annotations_add() { |
| 90 _assertDoesNotMatch(r''' | 114 _assertDoesNotMatch(r''' |
| 91 const my_annotation = const Object(); | 115 const my_annotation = const Object(); |
| 92 class A { | 116 class A { |
| 93 } | 117 } |
| 94 ''', r''' | 118 ''', r''' |
| 95 const my_annotation = const Object(); | 119 const my_annotation = const Object(); |
| 96 @my_annotation | 120 @my_annotation |
| 97 class A { | 121 class A { |
| 98 } | 122 } |
| (...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 } | 1732 } |
| 1709 | 1733 |
| 1710 void test_true_import_show_reorder() { | 1734 void test_true_import_show_reorder() { |
| 1711 _assertMatches(r''' | 1735 _assertMatches(r''' |
| 1712 import 'dart:async' show Future, Stream; | 1736 import 'dart:async' show Future, Stream; |
| 1713 ''', r''' | 1737 ''', r''' |
| 1714 import 'dart:async' show Stream, Future; | 1738 import 'dart:async' show Stream, Future; |
| 1715 '''); | 1739 '''); |
| 1716 } | 1740 } |
| 1717 | 1741 |
| 1718 void test_true_method_annotations_same() { | 1742 void test_true_method_annotation_accessor_same() { |
| 1719 _assertMatches(r''' | 1743 _assertMatches(r''' |
| 1720 const my_annotation = const Object(); | 1744 const my_annotation = const Object(); |
| 1721 class A { | 1745 class A { |
| 1722 @my_annotation | 1746 @my_annotation |
| 1723 void m() {} | 1747 void m() {} |
| 1724 } | 1748 } |
| 1725 ''', r''' | 1749 ''', r''' |
| 1726 const my_annotation = const Object(); | 1750 const my_annotation = const Object(); |
| 1727 class A { | 1751 class A { |
| 1728 @my_annotation | 1752 @my_annotation |
| 1729 void m() {} | 1753 void m() {} |
| 1730 } | 1754 } |
| 1731 '''); | 1755 '''); |
| 1732 } | 1756 } |
| 1733 | 1757 |
| 1758 void test_true_method_annotation_constructor_same() { |
| 1759 _assertMatches(r''' |
| 1760 class MyAnnotation { |
| 1761 const MyAnnotation(); |
| 1762 } |
| 1763 class A { |
| 1764 @MyAnnotation() |
| 1765 void m() {} |
| 1766 } |
| 1767 ''', r''' |
| 1768 class MyAnnotation { |
| 1769 const MyAnnotation(); |
| 1770 } |
| 1771 class A { |
| 1772 @MyAnnotation() |
| 1773 void m() {} |
| 1774 } |
| 1775 '''); |
| 1776 } |
| 1777 |
| 1734 void test_true_method_list_reorder() { | 1778 void test_true_method_list_reorder() { |
| 1735 _assertMatches(r''' | 1779 _assertMatches(r''' |
| 1736 class A { | 1780 class A { |
| 1737 a() {} | 1781 a() {} |
| 1738 b() {} | 1782 b() {} |
| 1739 c() {} | 1783 c() {} |
| 1740 } | 1784 } |
| 1741 ''', r''' | 1785 ''', r''' |
| 1742 class A { | 1786 class A { |
| 1743 c() {} | 1787 c() {} |
| (...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3522 } | 3566 } |
| 3523 } | 3567 } |
| 3524 | 3568 |
| 3525 | 3569 |
| 3526 class _Edit { | 3570 class _Edit { |
| 3527 final int offset; | 3571 final int offset; |
| 3528 final int length; | 3572 final int length; |
| 3529 final String replacement; | 3573 final String replacement; |
| 3530 _Edit(this.offset, this.length, this.replacement); | 3574 _Edit(this.offset, this.length, this.replacement); |
| 3531 } | 3575 } |
| OLD | NEW |