Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(599)

Unified Diff: pkg/analyzer/test/generated/incremental_resolver_test.dart

Issue 754673002: Matching of top-level functions, methods and accessors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/incremental_resolver_test.dart
diff --git a/pkg/analyzer/test/generated/incremental_resolver_test.dart b/pkg/analyzer/test/generated/incremental_resolver_test.dart
index b437c8232f87cdde98f9dcbbdc8fa87d670d8259..ab4eeb7b5c6bd6050f24eba8998093b3460df441 100644
--- a/pkg/analyzer/test/generated/incremental_resolver_test.dart
+++ b/pkg/analyzer/test/generated/incremental_resolver_test.dart
@@ -102,6 +102,84 @@ class B<T> {
''');
}
+ void test_false_classMemberAccessor_list_add() {
+ _assertCompilationUnitMatches(false, r'''
+class A {
+ get a => 1;
+ get b => 2;
+}
+''', r'''
+class A {
+ get a => 1;
+ get b => 2;
+ get c => 3;
+}
+''');
+ }
+
+ void test_false_classMemberAccessor_list_remove() {
+ _assertCompilationUnitMatches(false, r'''
+class A {
+ get a => 1;
+ get b => 2;
+ get c => 3;
+}
+''', r'''
+class A {
+ get a => 1;
+ get b => 2;
+}
+''');
+ }
+
+ void test_false_classMemberAccessor_wasGetter() {
+ _assertCompilationUnitMatches(false, r'''
+class A {
+ get a => 1;
+}
+''', r'''
+class A {
+ set a(x) {}
+}
+''');
+ }
+
+ void test_false_classMemberAccessor_wasInstance() {
+ _assertCompilationUnitMatches(false, r'''
+class A {
+ get a => 1;
+}
+''', r'''
+class A {
+ static get a => 1;
+}
+''');
+ }
+
+ void test_false_classMemberAccessor_wasSetter() {
+ _assertCompilationUnitMatches(false, r'''
+class A {
+ set a(x) {}
+}
+''', r'''
+class A {
+ get a => 1;
+}
+''');
+ }
+
+ void test_false_classMemberAccessor_wasStatic() {
+ _assertCompilationUnitMatches(false, r'''
+class A {
+ static get a => 1;
+}
+''', r'''
+class A {
+ get a => 1;
+}
+''');
+ }
+
void test_false_classTypeAlias_list_add() {
_assertCompilationUnitMatches(false, r'''
class M {}
@@ -538,6 +616,48 @@ import 'dart:async' show Future;
''');
}
+ void test_false_method_list_add() {
+ _assertCompilationUnitMatches(false, r'''
+class A {
+ a() {}
+ b() {}
+}
+''', r'''
+class A {
+ a() {}
+ b() {}
+ c() {}
+}
+''');
+ }
+
+ void test_false_method_list_remove() {
+ _assertCompilationUnitMatches(false, r'''
+class A {
+ a() {}
+ b() {}
+ c() {}
+}
+''', r'''
+class A {
+ a() {}
+ b() {}
+}
+''');
+ }
+
+ void test_false_method_returnType_edit() {
+ _assertCompilationUnitMatches(false, r'''
+class A {
+ int m() {}
+}
+''', r'''
+class A {
+ String m() {}
+}
+''');
+ }
+
void test_false_part_list_add() {
addNamedSource('/unitA.dart', 'part of lib; class A {}');
addNamedSource('/unitB.dart', 'part of lib; class B {}');
@@ -564,6 +684,104 @@ part 'unitA.dart';
''');
}
+ void test_false_topLevelAccessor_list_add() {
+ _assertCompilationUnitMatches(false, r'''
+get a => 1;
+get b => 2;
+''', r'''
+get a => 1;
+get b => 2;
+get c => 3;
+''');
+ }
+
+ void test_false_topLevelAccessor_list_remove() {
+ _assertCompilationUnitMatches(false, r'''
+get a => 1;
+get b => 2;
+get c => 3;
+''', r'''
+get a => 1;
+get b => 2;
+''');
+ }
+
+ void test_false_topLevelAccessor_wasGetter() {
+ _assertCompilationUnitMatches(false, r'''
+get a => 1;
+''', r'''
+set a(x) {}
+''');
+ }
+
+ void test_false_topLevelAccessor_wasSetter() {
+ _assertCompilationUnitMatches(false, r'''
+set a(x) {}
+''', r'''
+get a => 1;
+''');
+ }
+
+ void test_false_topLevelFunction_list_add() {
+ _assertCompilationUnitMatches(false, r'''
+a() {}
+b() {}
+''', r'''
+a() {}
+b() {}
+c() {}
+''');
+ }
+
+ void test_false_topLevelFunction_list_remove() {
+ _assertCompilationUnitMatches(false, r'''
+a() {}
+b() {}
+c() {}
+''', r'''
+a() {}
+b() {}
+''');
+ }
+
+ void test_false_topLevelFunction_parameters_list_add() {
+ _assertCompilationUnitMatches(false, r'''
+main(int a, int b) {
+}
+''', r'''
+main(int a, int b, int c) {
+}
+''');
+ }
+
+ void test_false_topLevelFunction_parameters_list_remove() {
+ _assertCompilationUnitMatches(false, r'''
+main(int a, int b, int c) {
+}
+''', r'''
+main(int a, int b) {
+}
+''');
+ }
+
+ void test_false_topLevelFunction_parameters_type_edit() {
+ _assertCompilationUnitMatches(false, r'''
+main(int a, int b, int c) {
+}
+''', r'''
+main(int a, String b, int c) {
+}
+''');
+ }
+
+ void test_false_topLevelFunction_returnType_edit() {
+ _assertCompilationUnitMatches(false, r'''
+int a() {}
+''', r'''
+String a() {}
+''');
+ }
+
void test_false_topLevelVariable_list_add() {
_assertCompilationUnitMatches(false, r'''
const int A = 1;
@@ -706,6 +924,38 @@ class A<T> {}
''');
}
+ void test_true_classMemberAccessor_list_reorder() {
+ _assertCompilationUnitMatches(true, r'''
+class A {
+ get a => 1;
+ get b => 2;
+ get c => 3;
+}
+''', r'''
+class A {
+ get c => 3;
+ get a => 1;
+ get b => 2;
+}
+''');
+ }
+
+ void test_true_classMemberAccessor_list_same() {
+ _assertCompilationUnitMatches(true, r'''
+class A {
+ get a => 1;
+ get b => 2;
+ get c => 3;
+}
+''', r'''
+class A {
+ get a => 1;
+ get b => 2;
+ get c => 3;
+}
+''');
+ }
+
void test_true_classTypeAlias_list_reorder() {
_assertCompilationUnitMatches(true, r'''
class M {}
@@ -983,6 +1233,74 @@ import 'dart:async' show Stream, Future;
''');
}
+ void test_true_method_list_reorder() {
+ _assertCompilationUnitMatches(true, r'''
+class A {
+ a() {}
+ b() {}
+ c() {}
+}
+''', r'''
+class A {
+ c() {}
+ a() {}
+ b() {}
+}
+''');
+ }
+
+ void test_true_method_list_same() {
+ _assertCompilationUnitMatches(true, r'''
+class A {
+ a() {}
+ b() {}
+ c() {}
+}
+''', r'''
+class A {
+ a() {}
+ b() {}
+ c() {}
+}
+''');
+ }
+
+ void test_true_method_operator_minus() {
+ _assertCompilationUnitMatches(true, r'''
+class A {
+ operator -(other) {}
+}
+''', r'''
+class A {
+ operator -(other) {}
+}
+''');
+ }
+
+ void test_true_method_operator_minusUnary() {
+ _assertCompilationUnitMatches(true, r'''
+class A {
+ operator -() {}
+}
+''', r'''
+class A {
+ operator -() {}
+}
+''');
+ }
+
+ void test_true_method_operator_plus() {
+ _assertCompilationUnitMatches(true, r'''
+class A {
+ operator +(other) {}
+}
+''', r'''
+class A {
+ operator +(other) {}
+}
+''');
+ }
+
void test_true_part_list_reorder() {
addNamedSource('/unitA.dart', 'part of lib; class A {}');
addNamedSource('/unitB.dart', 'part of lib; class B {}');
@@ -1011,6 +1329,54 @@ part 'unitB.dart';
''');
}
+ void test_true_topLevelAccessor_list_reorder() {
+ _assertCompilationUnitMatches(true, r'''
+set a(x) {}
+set b(x) {}
+set c(x) {}
+''', r'''
+set c(x) {}
+set a(x) {}
+set b(x) {}
+''');
+ }
+
+ void test_true_topLevelAccessor_list_same() {
+ _assertCompilationUnitMatches(true, r'''
+get a => 1;
+get b => 2;
+get c => 3;
+''', r'''
+get a => 1;
+get b => 2;
+get c => 3;
+''');
+ }
+
+ void test_true_topLevelFunction_list_reorder() {
+ _assertCompilationUnitMatches(true, r'''
+a() {}
+b() {}
+c() {}
+''', r'''
+c() {}
+a() {}
+b() {}
+''');
+ }
+
+ void test_true_topLevelFunction_list_same() {
+ _assertCompilationUnitMatches(true, r'''
+a() {}
+b() {}
+c() {}
+''', r'''
+a() {}
+b() {}
+c() {}
+''');
+ }
+
void test_true_topLevelVariable_list_reorder() {
_assertCompilationUnitMatches(true, r'''
const int A = 1;
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698