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 test.services.completion.target; | 5 library test.services.completion.target; |
| 6 | 6 |
| 7 import 'dart:async'; | |
| 8 | |
| 7 import 'package:analysis_server/src/provisional/completion/dart/completion_targe t.dart'; | 9 import 'package:analysis_server/src/provisional/completion/dart/completion_targe t.dart'; |
| 8 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| 11 import 'package:analyzer/src/dart/analysis/driver.dart'; | |
| 9 import 'package:analyzer/src/generated/source.dart'; | 12 import 'package:analyzer/src/generated/source.dart'; |
| 10 import 'package:test/test.dart'; | 13 import 'package:test/test.dart'; |
| 11 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 14 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 12 | 15 |
| 13 import '../../abstract_context.dart'; | 16 import '../../abstract_context.dart'; |
| 14 | 17 |
| 15 main() { | 18 main() { |
| 16 defineReflectiveSuite(() { | 19 defineReflectiveSuite(() { |
| 17 defineReflectiveTests(CompletionTargetTest); | 20 defineReflectiveTests(CompletionTargetTest); |
| 18 }); | 21 }); |
| 19 } | 22 } |
| 20 | 23 |
| 21 @reflectiveTest | 24 @reflectiveTest |
| 22 class CompletionTargetTest extends AbstractContextTest { | 25 class CompletionTargetTest extends AbstractContextTest { |
| 23 Source testSource; | 26 Source testSource; |
| 24 int completionOffset; | 27 int completionOffset; |
| 25 CompletionTarget target; | 28 CompletionTarget target; |
| 26 | 29 |
| 27 void addTestSource(String content) { | 30 @override |
| 31 bool get enableNewAnalysisDriver => true; | |
| 32 | |
| 33 Future<Null> addTestSource(String content) async { | |
| 28 expect(completionOffset, isNull, reason: 'Call addTestSource exactly once'); | 34 expect(completionOffset, isNull, reason: 'Call addTestSource exactly once'); |
| 29 completionOffset = content.indexOf('^'); | 35 completionOffset = content.indexOf('^'); |
| 30 expect(completionOffset, isNot(equals(-1)), reason: 'missing ^'); | 36 expect(completionOffset, isNot(equals(-1)), reason: 'missing ^'); |
| 31 int nextOffset = content.indexOf('^', completionOffset + 1); | 37 int nextOffset = content.indexOf('^', completionOffset + 1); |
| 32 expect(nextOffset, equals(-1), reason: 'too many ^'); | 38 expect(nextOffset, equals(-1), reason: 'too many ^'); |
| 33 content = content.substring(0, completionOffset) + | 39 content = content.substring(0, completionOffset) + |
| 34 content.substring(completionOffset + 1); | 40 content.substring(completionOffset + 1); |
| 35 testSource = addSource('/test.dart', content); | 41 testSource = addSource('/test.dart', content); |
| 36 CompilationUnit unit = context.parseCompilationUnit(testSource); | 42 AnalysisResult result = await driver.getResult(testSource.fullName); |
|
scheglov
2017/05/05 19:37:12
I think that practically we don't use "testSource"
Brian Wilkerson
2017/05/05 20:19:59
There are currently over 700 invocations of addSou
| |
| 37 target = new CompletionTarget.forOffset(unit, completionOffset); | 43 target = new CompletionTarget.forOffset(result.unit, completionOffset); |
| 38 } | 44 } |
| 39 | 45 |
| 40 void assertTarget(entityText, nodeText, | 46 Future<Null> assertTarget(entityText, nodeText, |
| 41 {int argIndex: null, bool isFunctionalArgument: false}) { | 47 {int argIndex: null, bool isFunctionalArgument: false}) async { |
| 42 void assertCommon() { | 48 void assertCommon() { |
| 43 expect(target.entity.toString(), entityText, reason: 'entity'); | 49 expect(target.entity.toString(), entityText, reason: 'entity'); |
| 44 expect(target.containingNode.toString(), nodeText, | 50 expect(target.containingNode.toString(), nodeText, |
| 45 reason: 'containingNode'); | 51 reason: 'containingNode'); |
| 46 expect(target.argIndex, argIndex, reason: 'argIndex'); | 52 expect(target.argIndex, argIndex, reason: 'argIndex'); |
| 47 } | 53 } |
| 48 | 54 |
| 49 // Assert with parsed unit | 55 // Assert with parsed unit |
| 50 assertCommon(); | 56 assertCommon(); |
| 51 CompilationUnit unit = | 57 AnalysisResult result = await driver.getResult(testSource.fullName); |
| 52 context.resolveCompilationUnit2(testSource, testSource); | 58 target = new CompletionTarget.forOffset(result.unit, completionOffset); |
| 53 target = new CompletionTarget.forOffset(unit, completionOffset); | |
| 54 // Assert more with resolved unit | 59 // Assert more with resolved unit |
| 55 assertCommon(); | 60 assertCommon(); |
| 56 expect(target.isFunctionalArgument(), isFunctionalArgument); | 61 expect(target.isFunctionalArgument(), isFunctionalArgument); |
| 57 } | 62 } |
| 58 | 63 |
| 59 test_ArgumentList_InstanceCreationExpression() { | 64 test_ArgumentList_InstanceCreationExpression() async { |
| 60 // ArgumentList InstanceCreationExpression Block | 65 // ArgumentList InstanceCreationExpression Block |
| 61 addTestSource('main() {new Foo(^)}'); | 66 await addTestSource('main() {new Foo(^)}'); |
| 62 assertTarget(')', '()', argIndex: 0); | 67 await assertTarget(')', '()', argIndex: 0); |
| 63 } | 68 } |
| 64 | 69 |
| 65 test_ArgumentList_InstanceCreationExpression2() { | 70 test_ArgumentList_InstanceCreationExpression2() async { |
| 66 // ArgumentList InstanceCreationExpression Block | 71 // ArgumentList InstanceCreationExpression Block |
| 67 addTestSource('main() {new Foo(a,^)}'); | 72 await addTestSource('main() {new Foo(a,^)}'); |
| 68 assertTarget(')', '(a)', argIndex: 1); | 73 await assertTarget(')', '(a)', argIndex: 1); |
| 69 } | 74 } |
| 70 | 75 |
| 71 test_ArgumentList_InstanceCreationExpression_functionArg2() { | 76 test_ArgumentList_InstanceCreationExpression_functionArg2() async { |
| 72 // ArgumentList InstanceCreationExpression Block | 77 // ArgumentList InstanceCreationExpression Block |
| 73 addTestSource('main() {new B(^)} class B{B(f()){}}'); | 78 await addTestSource('main() {new B(^)} class B{B(f()){}}'); |
| 74 assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true); | 79 await assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true); |
| 75 } | 80 } |
| 76 | 81 |
| 77 test_ArgumentList_InstanceCreationExpression_functionArg3() { | 82 test_ArgumentList_InstanceCreationExpression_functionArg3() async { |
| 78 // ArgumentList InstanceCreationExpression Block | 83 // ArgumentList InstanceCreationExpression Block |
| 79 addTestSource('main() {new B(1, f: ^)} class B{B(int i, {f()}){}}'); | 84 await addTestSource('main() {new B(1, f: ^)} class B{B(int i, {f()}){}}'); |
| 80 assertTarget('', 'f: ', argIndex: 1, isFunctionalArgument: true); | 85 await assertTarget('', 'f: ', argIndex: 1, isFunctionalArgument: true); |
| 81 } | 86 } |
| 82 | 87 |
| 83 test_ArgumentList_MethodInvocation() { | 88 test_ArgumentList_MethodInvocation() async { |
| 84 // ArgumentList MethodInvocation Block | 89 // ArgumentList MethodInvocation Block |
| 85 addTestSource('main() {foo(^)}'); | 90 await addTestSource('main() {foo(^)}'); |
| 86 assertTarget(')', '()', argIndex: 0); | 91 await assertTarget(')', '()', argIndex: 0); |
| 87 } | 92 } |
| 88 | 93 |
| 89 test_ArgumentList_MethodInvocation2() { | 94 test_ArgumentList_MethodInvocation2() async { |
| 90 // ArgumentList MethodInvocation Block | 95 // ArgumentList MethodInvocation Block |
| 91 addTestSource('main() {foo(^n)}'); | 96 await addTestSource('main() {foo(^n)}'); |
| 92 assertTarget('n', '(n)', argIndex: 0); | 97 await assertTarget('n', '(n)', argIndex: 0); |
| 93 } | 98 } |
| 94 | 99 |
| 95 test_ArgumentList_MethodInvocation3() { | 100 test_ArgumentList_MethodInvocation3() async { |
| 96 // ArgumentList MethodInvocation Block | 101 // ArgumentList MethodInvocation Block |
| 97 addTestSource('main() {foo(n^)}'); | 102 await addTestSource('main() {foo(n^)}'); |
| 98 assertTarget('n', '(n)', argIndex: 0); | 103 await assertTarget('n', '(n)', argIndex: 0); |
| 99 } | 104 } |
| 100 | 105 |
| 101 test_ArgumentList_MethodInvocation3a() { | 106 test_ArgumentList_MethodInvocation3a() async { |
| 102 // ArgumentList MethodInvocation Block | 107 // ArgumentList MethodInvocation Block |
| 103 addTestSource('main() {foo((n)^)}'); | 108 await addTestSource('main() {foo((n)^)}'); |
| 104 assertTarget(')', '((n))', argIndex: 0); | 109 await assertTarget(')', '((n))', argIndex: 0); |
| 105 } | 110 } |
| 106 | 111 |
| 107 test_ArgumentList_MethodInvocation4() { | 112 test_ArgumentList_MethodInvocation4() async { |
| 108 // ArgumentList MethodInvocation Block | 113 // ArgumentList MethodInvocation Block |
| 109 addTestSource('main() {foo(n,^)}'); | 114 await addTestSource('main() {foo(n,^)}'); |
| 110 assertTarget(')', '(n)', argIndex: 1); | 115 await assertTarget(')', '(n)', argIndex: 1); |
| 111 } | 116 } |
| 112 | 117 |
| 113 test_ArgumentList_MethodInvocation_functionArg() { | 118 test_ArgumentList_MethodInvocation_functionArg() async { |
| 114 // ArgumentList MethodInvocation Block | 119 // ArgumentList MethodInvocation Block |
| 115 addTestSource('main() {foo(^)} foo(f()) {}'); | 120 await addTestSource('main() {foo(^)} foo(f()) {}'); |
| 116 assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true); | 121 await assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true); |
| 117 } | 122 } |
| 118 | 123 |
| 119 test_ArgumentList_MethodInvocation_functionArg2() { | 124 test_ArgumentList_MethodInvocation_functionArg2() async { |
| 120 // ArgumentList MethodInvocation Block | 125 // ArgumentList MethodInvocation Block |
| 121 addTestSource('main() {new B().boo(^)} class B{boo(f()){}}'); | 126 await addTestSource('main() {new B().boo(^)} class B{boo(f()){}}'); |
| 122 assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true); | 127 await assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true); |
| 123 } | 128 } |
| 124 | 129 |
| 125 test_ArgumentList_MethodInvocation_functionArg3() { | 130 test_ArgumentList_MethodInvocation_functionArg3() async { |
| 126 // ArgumentList MethodInvocation Block | 131 // ArgumentList MethodInvocation Block |
| 127 addTestSource('main() {foo(f: ^)} foo({f()}) {}'); | 132 await addTestSource('main() {foo(f: ^)} foo({f()}) {}'); |
| 128 assertTarget('', 'f: ', argIndex: 0, isFunctionalArgument: true); | 133 await assertTarget('', 'f: ', argIndex: 0, isFunctionalArgument: true); |
| 129 } | 134 } |
| 130 | 135 |
| 131 test_ArgumentList_MethodInvocation_functionArg4() { | 136 test_ArgumentList_MethodInvocation_functionArg4() async { |
| 132 // ArgumentList MethodInvocation Block | 137 // ArgumentList MethodInvocation Block |
| 133 addTestSource('main() {new B().boo(f: ^)} class B{boo({f()}){}}'); | 138 await addTestSource('main() {new B().boo(f: ^)} class B{boo({f()}){}}'); |
| 134 assertTarget('', 'f: ', argIndex: 0, isFunctionalArgument: true); | 139 await assertTarget('', 'f: ', argIndex: 0, isFunctionalArgument: true); |
| 135 } | 140 } |
| 136 | 141 |
| 137 test_AsExpression_identifier() { | 142 test_AsExpression_identifier() async { |
| 138 // SimpleIdentifier TypeName AsExpression | 143 // SimpleIdentifier TypeName AsExpression |
| 139 addTestSource('class A {var b; X _c; foo() {var a; (a^ as String).foo();}'); | 144 await addTestSource( |
| 140 assertTarget('a as String', '(a as String)'); | 145 'class A {var b; X _c; foo() {var a; (a^ as String).foo();}'); |
| 141 } | 146 await assertTarget('a as String', '(a as String)'); |
| 142 | 147 } |
| 143 test_AsExpression_keyword() { | 148 |
| 149 test_AsExpression_keyword() async { | |
| 144 // SimpleIdentifier TypeName AsExpression | 150 // SimpleIdentifier TypeName AsExpression |
| 145 addTestSource('class A {var b; X _c; foo() {var a; (a ^as String).foo();}'); | 151 await addTestSource( |
| 146 assertTarget('as', 'a as String'); | 152 'class A {var b; X _c; foo() {var a; (a ^as String).foo();}'); |
| 147 } | 153 await assertTarget('as', 'a as String'); |
| 148 | 154 } |
| 149 test_AsExpression_keyword2() { | 155 |
| 156 test_AsExpression_keyword2() async { | |
| 150 // SimpleIdentifier TypeName AsExpression | 157 // SimpleIdentifier TypeName AsExpression |
| 151 addTestSource('class A {var b; X _c; foo() {var a; (a a^s String).foo();}'); | 158 await addTestSource( |
| 152 assertTarget('as', 'a as String'); | 159 'class A {var b; X _c; foo() {var a; (a a^s String).foo();}'); |
| 153 } | 160 await assertTarget('as', 'a as String'); |
| 154 | 161 } |
| 155 test_AsExpression_keyword3() { | 162 |
| 163 test_AsExpression_keyword3() async { | |
| 156 // SimpleIdentifier TypeName AsExpression | 164 // SimpleIdentifier TypeName AsExpression |
| 157 addTestSource('class A {var b; X _c; foo() {var a; (a as^ String).foo();}'); | 165 await addTestSource( |
| 158 assertTarget('as', 'a as String'); | 166 'class A {var b; X _c; foo() {var a; (a as^ String).foo();}'); |
| 159 } | 167 await assertTarget('as', 'a as String'); |
| 160 | 168 } |
| 161 test_AsExpression_type() { | 169 |
| 170 test_AsExpression_type() async { | |
| 162 // SimpleIdentifier TypeName AsExpression | 171 // SimpleIdentifier TypeName AsExpression |
| 163 addTestSource('class A {var b; X _c; foo() {var a; (a as ^String).foo();}'); | 172 await addTestSource( |
| 164 assertTarget('String', 'a as String'); | 173 'class A {var b; X _c; foo() {var a; (a as ^String).foo();}'); |
| 165 } | 174 await assertTarget('String', 'a as String'); |
| 166 | 175 } |
| 167 test_Block() { | 176 |
| 177 test_Block() async { | |
| 168 // Block | 178 // Block |
| 169 addTestSource('main() {^}'); | 179 await addTestSource('main() {^}'); |
| 170 assertTarget('}', '{}'); | 180 await assertTarget('}', '{}'); |
| 171 } | 181 } |
| 172 | 182 |
| 173 test_Block_keyword() { | 183 test_Block_keyword() async { |
| 174 addTestSource('class C { static C get instance => null; } main() {C.in^}'); | 184 await addTestSource( |
| 175 assertTarget('in', 'C.in'); | 185 'class C { static C get instance => null; } main() {C.in^}'); |
| 176 } | 186 await assertTarget('in', 'C.in'); |
| 177 | 187 } |
| 178 test_Block_keyword2() { | 188 |
| 179 addTestSource('class C { static C get instance => null; } main() {C.i^n}'); | 189 test_Block_keyword2() async { |
| 180 assertTarget('in', 'C.in'); | 190 await addTestSource( |
| 181 } | 191 'class C { static C get instance => null; } main() {C.i^n}'); |
| 182 | 192 await assertTarget('in', 'C.in'); |
| 183 test_FormalParameter_partialType() { | 193 } |
| 194 | |
| 195 test_FormalParameter_partialType() async { | |
| 184 // SimpleIdentifier PrefixedIdentifier TypeName | 196 // SimpleIdentifier PrefixedIdentifier TypeName |
| 185 addTestSource('foo(b.^ f) { }'); | 197 await addTestSource('foo(b.^ f) { }'); |
| 186 assertTarget('f', 'b.f'); | 198 await assertTarget('f', 'b.f'); |
| 187 } | 199 } |
| 188 | 200 |
| 189 test_FormalParameter_partialType2() { | 201 test_FormalParameter_partialType2() async { |
| 190 // SimpleIdentifier PrefixedIdentifier TypeName | 202 // SimpleIdentifier PrefixedIdentifier TypeName |
| 191 addTestSource('foo(b.z^ f) { }'); | 203 await addTestSource('foo(b.z^ f) { }'); |
| 192 assertTarget('z', 'b.z'); | 204 await assertTarget('z', 'b.z'); |
| 193 } | 205 } |
| 194 | 206 |
| 195 test_FormalParameter_partialType3() { | 207 test_FormalParameter_partialType3() async { |
| 196 // SimpleIdentifier PrefixedIdentifier TypeName | 208 // SimpleIdentifier PrefixedIdentifier TypeName |
| 197 addTestSource('foo(b.^) { }'); | 209 await addTestSource('foo(b.^) { }'); |
| 198 assertTarget('', 'b.'); | 210 await assertTarget('', 'b.'); |
| 199 } | 211 } |
| 200 | 212 |
| 201 test_FormalParameterList() { | 213 test_FormalParameterList() async { |
| 202 // Token FormalParameterList FunctionExpression | 214 // Token FormalParameterList FunctionExpression |
| 203 addTestSource('foo(^) { }'); | 215 await addTestSource('foo(^) { }'); |
| 204 assertTarget(')', '()'); | 216 await assertTarget(')', '()'); |
| 205 } | 217 } |
| 206 | 218 |
| 207 test_FunctionDeclaration_inLineComment() { | 219 test_FunctionDeclaration_inLineComment() async { |
| 208 // Comment CompilationUnit | 220 // Comment CompilationUnit |
| 209 addTestSource(''' | 221 await addTestSource(''' |
| 210 // normal comment ^ | 222 // normal comment ^ |
| 211 zoo(z) { } String name;'''); | 223 zoo(z) { } String name;'''); |
| 212 assertTarget('// normal comment ', 'zoo(z) {} String name;'); | 224 await assertTarget('// normal comment ', 'zoo(z) {} String name;'); |
| 213 } | 225 } |
| 214 | 226 |
| 215 test_FunctionDeclaration_inLineComment2() { | 227 test_FunctionDeclaration_inLineComment2() async { |
| 216 // Comment CompilationUnit | 228 // Comment CompilationUnit |
| 217 addTestSource(''' | 229 await addTestSource(''' |
| 218 // normal ^comment | 230 // normal ^comment |
| 219 zoo(z) { } String name;'''); | 231 zoo(z) { } String name;'''); |
| 220 assertTarget('// normal comment', 'zoo(z) {} String name;'); | 232 await assertTarget('// normal comment', 'zoo(z) {} String name;'); |
| 221 } | 233 } |
| 222 | 234 |
| 223 test_FunctionDeclaration_inLineComment3() { | 235 test_FunctionDeclaration_inLineComment3() async { |
| 224 // Comment CompilationUnit | 236 // Comment CompilationUnit |
| 225 addTestSource(''' | 237 await addTestSource(''' |
| 226 // normal comment ^ | 238 // normal comment ^ |
| 227 // normal comment 2 | 239 // normal comment 2 |
| 228 zoo(z) { } String name;'''); | 240 zoo(z) { } String name;'''); |
| 229 assertTarget('// normal comment ', 'zoo(z) {} String name;'); | 241 await assertTarget('// normal comment ', 'zoo(z) {} String name;'); |
| 230 } | 242 } |
| 231 | 243 |
| 232 test_FunctionDeclaration_inLineComment4() { | 244 test_FunctionDeclaration_inLineComment4() async { |
| 233 // Comment CompilationUnit | 245 // Comment CompilationUnit |
| 234 addTestSource(''' | 246 await addTestSource(''' |
| 235 // normal comment | 247 // normal comment |
| 236 // normal comment 2^ | 248 // normal comment 2^ |
| 237 zoo(z) { } String name;'''); | 249 zoo(z) { } String name;'''); |
| 238 assertTarget('// normal comment 2', 'zoo(z) {} String name;'); | 250 await assertTarget('// normal comment 2', 'zoo(z) {} String name;'); |
| 239 } | 251 } |
| 240 | 252 |
| 241 test_FunctionDeclaration_inLineDocComment() { | 253 test_FunctionDeclaration_inLineDocComment() async { |
| 242 // Comment FunctionDeclaration CompilationUnit | 254 // Comment FunctionDeclaration CompilationUnit |
| 243 addTestSource(''' | 255 await addTestSource(''' |
| 244 /// some dartdoc ^ | 256 /// some dartdoc ^ |
| 245 zoo(z) { } String name;'''); | 257 zoo(z) { } String name;'''); |
| 246 assertTarget('/// some dartdoc ', ''); | 258 await assertTarget('/// some dartdoc ', ''); |
| 247 expect(target.containingNode is Comment, isTrue); | 259 expect(target.containingNode is Comment, isTrue); |
| 248 expect(target.containingNode.parent.toSource(), 'zoo(z) {}'); | 260 expect(target.containingNode.parent.toSource(), 'zoo(z) {}'); |
| 249 } | 261 } |
| 250 | 262 |
| 251 test_FunctionDeclaration_inLineDocComment2() { | 263 test_FunctionDeclaration_inLineDocComment2() async { |
| 252 // Comment FunctionDeclaration CompilationUnit | 264 // Comment FunctionDeclaration CompilationUnit |
| 253 addTestSource(''' | 265 await addTestSource(''' |
| 254 /// some ^dartdoc | 266 /// some ^dartdoc |
| 255 zoo(z) { } String name;'''); | 267 zoo(z) { } String name;'''); |
| 256 assertTarget('/// some dartdoc', ''); | 268 await assertTarget('/// some dartdoc', ''); |
| 257 expect(target.containingNode is Comment, isTrue); | 269 expect(target.containingNode is Comment, isTrue); |
| 258 expect(target.containingNode.parent.toSource(), 'zoo(z) {}'); | 270 expect(target.containingNode.parent.toSource(), 'zoo(z) {}'); |
| 259 } | 271 } |
| 260 | 272 |
| 261 test_FunctionDeclaration_inStarComment() { | 273 test_FunctionDeclaration_inStarComment() async { |
| 262 // Comment CompilationUnit | 274 // Comment CompilationUnit |
| 263 addTestSource('/* ^ */ zoo(z) {} String name;'); | 275 await addTestSource('/* ^ */ zoo(z) {} String name;'); |
| 264 assertTarget('/* */', 'zoo(z) {} String name;'); | 276 await assertTarget('/* */', 'zoo(z) {} String name;'); |
| 265 } | 277 } |
| 266 | 278 |
| 267 test_FunctionDeclaration_inStarComment2() { | 279 test_FunctionDeclaration_inStarComment2() async { |
| 268 // Comment CompilationUnit | 280 // Comment CompilationUnit |
| 269 addTestSource('/* *^/ zoo(z) {} String name;'); | 281 await addTestSource('/* *^/ zoo(z) {} String name;'); |
| 270 assertTarget('/* */', 'zoo(z) {} String name;'); | 282 await assertTarget('/* */', 'zoo(z) {} String name;'); |
| 271 } | 283 } |
| 272 | 284 |
| 273 test_FunctionDeclaration_inStarDocComment() { | 285 test_FunctionDeclaration_inStarDocComment() async { |
| 274 // Comment FunctionDeclaration CompilationUnit | 286 // Comment FunctionDeclaration CompilationUnit |
| 275 addTestSource('/** ^ */ zoo(z) { } String name;'); | 287 await addTestSource('/** ^ */ zoo(z) { } String name;'); |
| 276 assertTarget('/** */', ''); | 288 await assertTarget('/** */', ''); |
| 277 expect(target.containingNode is Comment, isTrue); | 289 expect(target.containingNode is Comment, isTrue); |
| 278 expect(target.containingNode.parent.toSource(), 'zoo(z) {}'); | 290 expect(target.containingNode.parent.toSource(), 'zoo(z) {}'); |
| 279 } | 291 } |
| 280 | 292 |
| 281 test_FunctionDeclaration_inStarDocComment2() { | 293 test_FunctionDeclaration_inStarDocComment2() async { |
| 282 // Comment FunctionDeclaration CompilationUnit | 294 // Comment FunctionDeclaration CompilationUnit |
| 283 addTestSource('/** *^/ zoo(z) { } String name;'); | 295 await addTestSource('/** *^/ zoo(z) { } String name;'); |
| 284 assertTarget('/** */', ''); | 296 await assertTarget('/** */', ''); |
| 285 expect(target.containingNode is Comment, isTrue); | 297 expect(target.containingNode is Comment, isTrue); |
| 286 expect(target.containingNode.parent.toSource(), 'zoo(z) {}'); | 298 expect(target.containingNode.parent.toSource(), 'zoo(z) {}'); |
| 287 } | 299 } |
| 288 | 300 |
| 289 test_FunctionDeclaration_returnType() { | 301 test_FunctionDeclaration_returnType() async { |
| 290 // CompilationUnit | 302 // CompilationUnit |
| 291 addTestSource('^ zoo(z) { } String name;'); | 303 await addTestSource('^ zoo(z) { } String name;'); |
| 292 assertTarget('zoo(z) {}', 'zoo(z) {} String name;'); | 304 await assertTarget('zoo(z) {}', 'zoo(z) {} String name;'); |
| 293 } | 305 } |
| 294 | 306 |
| 295 test_FunctionDeclaration_returnType_afterLineComment() { | 307 test_FunctionDeclaration_returnType_afterLineComment() async { |
| 296 // FunctionDeclaration CompilationUnit | 308 // FunctionDeclaration CompilationUnit |
| 297 addTestSource(''' | 309 await addTestSource(''' |
| 298 // normal comment | 310 // normal comment |
| 299 ^ zoo(z) {} String name;'''); | 311 ^ zoo(z) {} String name;'''); |
| 300 assertTarget('zoo(z) {}', 'zoo(z) {} String name;'); | 312 await assertTarget('zoo(z) {}', 'zoo(z) {} String name;'); |
| 301 } | 313 } |
| 302 | 314 |
| 303 test_FunctionDeclaration_returnType_afterLineComment2() { | 315 test_FunctionDeclaration_returnType_afterLineComment2() async { |
| 304 // FunctionDeclaration CompilationUnit | 316 // FunctionDeclaration CompilationUnit |
| 305 // TOD(danrubel) left align all test source | 317 // TOD(danrubel) left align all test source |
| 306 addTestSource(''' | 318 await addTestSource(''' |
| 307 // normal comment | 319 // normal comment |
| 308 ^ zoo(z) {} String name;'''); | 320 ^ zoo(z) {} String name;'''); |
| 309 assertTarget('zoo(z) {}', 'zoo(z) {} String name;'); | 321 await assertTarget('zoo(z) {}', 'zoo(z) {} String name;'); |
| 310 } | 322 } |
| 311 | 323 |
| 312 test_FunctionDeclaration_returnType_afterLineDocComment() { | 324 test_FunctionDeclaration_returnType_afterLineDocComment() async { |
| 313 // SimpleIdentifier FunctionDeclaration CompilationUnit | 325 // SimpleIdentifier FunctionDeclaration CompilationUnit |
| 314 addTestSource(''' | 326 await addTestSource(''' |
| 315 /// some dartdoc | 327 /// some dartdoc |
| 316 ^ zoo(z) { } String name; '''); | 328 ^ zoo(z) { } String name; '''); |
| 317 assertTarget('zoo', 'zoo(z) {}'); | 329 await assertTarget('zoo', 'zoo(z) {}'); |
| 318 } | 330 } |
| 319 | 331 |
| 320 test_FunctionDeclaration_returnType_afterLineDocComment2() { | 332 test_FunctionDeclaration_returnType_afterLineDocComment2() async { |
| 321 // SimpleIdentifier FunctionDeclaration CompilationUnit | 333 // SimpleIdentifier FunctionDeclaration CompilationUnit |
| 322 addTestSource(''' | 334 await addTestSource(''' |
| 323 /// some dartdoc | 335 /// some dartdoc |
| 324 ^ zoo(z) { } String name;'''); | 336 ^ zoo(z) { } String name;'''); |
| 325 assertTarget('zoo', 'zoo(z) {}'); | 337 await assertTarget('zoo', 'zoo(z) {}'); |
| 326 } | 338 } |
| 327 | 339 |
| 328 test_FunctionDeclaration_returnType_afterStarComment() { | 340 test_FunctionDeclaration_returnType_afterStarComment() async { |
| 329 // CompilationUnit | 341 // CompilationUnit |
| 330 addTestSource('/* */ ^ zoo(z) { } String name;'); | 342 await addTestSource('/* */ ^ zoo(z) { } String name;'); |
| 331 assertTarget('zoo(z) {}', 'zoo(z) {} String name;'); | 343 await assertTarget('zoo(z) {}', 'zoo(z) {} String name;'); |
| 332 } | 344 } |
| 333 | 345 |
| 334 test_FunctionDeclaration_returnType_afterStarComment2() { | 346 test_FunctionDeclaration_returnType_afterStarComment2() async { |
| 335 // CompilationUnit | 347 // CompilationUnit |
| 336 addTestSource('/* */^ zoo(z) { } String name;'); | 348 await addTestSource('/* */^ zoo(z) { } String name;'); |
| 337 assertTarget('zoo(z) {}', 'zoo(z) {} String name;'); | 349 await assertTarget('zoo(z) {}', 'zoo(z) {} String name;'); |
| 338 } | 350 } |
| 339 | 351 |
| 340 test_FunctionDeclaration_returnType_afterStarDocComment() { | 352 test_FunctionDeclaration_returnType_afterStarDocComment() async { |
| 341 // FunctionDeclaration CompilationUnit | 353 // FunctionDeclaration CompilationUnit |
| 342 addTestSource('/** */ ^ zoo(z) { } String name;'); | 354 await addTestSource('/** */ ^ zoo(z) { } String name;'); |
| 343 assertTarget('zoo', 'zoo(z) {}'); | 355 await assertTarget('zoo', 'zoo(z) {}'); |
| 344 } | 356 } |
| 345 | 357 |
| 346 test_FunctionDeclaration_returnType_afterStarDocComment2() { | 358 test_FunctionDeclaration_returnType_afterStarDocComment2() async { |
| 347 // FunctionDeclaration CompilationUnit | 359 // FunctionDeclaration CompilationUnit |
| 348 addTestSource('/** */^ zoo(z) { } String name;'); | 360 await addTestSource('/** */^ zoo(z) { } String name;'); |
| 349 assertTarget('zoo', 'zoo(z) {}'); | 361 await assertTarget('zoo', 'zoo(z) {}'); |
| 350 } | 362 } |
| 351 | 363 |
| 352 test_InstanceCreationExpression_identifier() { | 364 test_InstanceCreationExpression_identifier() async { |
| 353 // InstanceCreationExpression ExpressionStatement Block | 365 // InstanceCreationExpression ExpressionStatement Block |
| 354 addTestSource('class C {foo(){var f; {var x;} new ^C();}}'); | 366 await addTestSource('class C {foo(){var f; {var x;} new ^C();}}'); |
| 355 assertTarget('C', 'new C()'); | 367 await assertTarget('C', 'new C()'); |
| 356 } | 368 } |
| 357 | 369 |
| 358 test_InstanceCreationExpression_keyword() { | 370 test_InstanceCreationExpression_keyword() async { |
| 359 // InstanceCreationExpression ExpressionStatement Block | 371 // InstanceCreationExpression ExpressionStatement Block |
| 360 addTestSource('class C {foo(){var f; {var x;} new^ }}'); | 372 await addTestSource('class C {foo(){var f; {var x;} new^ }}'); |
| 361 assertTarget('new ();', '{var f; {var x;} new ();}'); | 373 await assertTarget('new ();', '{var f; {var x;} new ();}'); |
| 362 } | 374 } |
| 363 | 375 |
| 364 test_InstanceCreationExpression_keyword2() { | 376 test_InstanceCreationExpression_keyword2() async { |
| 365 // InstanceCreationExpression ExpressionStatement Block | 377 // InstanceCreationExpression ExpressionStatement Block |
| 366 addTestSource('class C {foo(){var f; {var x;} new^ C();}}'); | 378 await addTestSource('class C {foo(){var f; {var x;} new^ C();}}'); |
| 367 assertTarget('new C();', '{var f; {var x;} new C();}'); | 379 await assertTarget('new C();', '{var f; {var x;} new C();}'); |
| 368 } | 380 } |
| 369 | 381 |
| 370 test_MapLiteralEntry() { | 382 test_MapLiteralEntry() async { |
| 371 // MapLiteralEntry MapLiteral VariableDeclaration | 383 // MapLiteralEntry MapLiteral VariableDeclaration |
| 372 addTestSource('foo = {^'); | 384 await addTestSource('foo = {^'); |
| 373 assertTarget(' : ', '{ : }'); | 385 await assertTarget(' : ', '{ : }'); |
| 374 } | 386 } |
| 375 | 387 |
| 376 test_MapLiteralEntry1() { | 388 test_MapLiteralEntry1() async { |
| 377 // MapLiteralEntry MapLiteral VariableDeclaration | 389 // MapLiteralEntry MapLiteral VariableDeclaration |
| 378 addTestSource('foo = {T^'); | 390 await addTestSource('foo = {T^'); |
| 379 assertTarget('T : ', '{T : }'); | 391 await assertTarget('T : ', '{T : }'); |
| 380 } | 392 } |
| 381 | 393 |
| 382 test_MapLiteralEntry2() { | 394 test_MapLiteralEntry2() async { |
| 383 // SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration | 395 // SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration |
| 384 addTestSource('foo = {7:T^};'); | 396 await addTestSource('foo = {7:T^};'); |
| 385 assertTarget('T', '7 : T'); | 397 await assertTarget('T', '7 : T'); |
| 386 } | 398 } |
| 387 | 399 |
| 388 test_MethodDeclaration_inLineComment() { | 400 test_MethodDeclaration_inLineComment() async { |
| 389 // Comment ClassDeclaration CompilationUnit | 401 // Comment ClassDeclaration CompilationUnit |
| 390 addTestSource(''' | 402 await addTestSource(''' |
| 391 class C2 { | 403 class C2 { |
| 392 // normal comment ^ | 404 // normal comment ^ |
| 393 zoo(z) { } String name; }'''); | 405 zoo(z) { } String name; }'''); |
| 394 assertTarget('// normal comment ', 'class C2 {zoo(z) {} String name;}'); | 406 await assertTarget( |
| 395 } | 407 '// normal comment ', 'class C2 {zoo(z) {} String name;}'); |
| 396 | 408 } |
| 397 test_MethodDeclaration_inLineComment2() { | 409 |
| 410 test_MethodDeclaration_inLineComment2() async { | |
| 398 // Comment ClassDeclaration CompilationUnit | 411 // Comment ClassDeclaration CompilationUnit |
| 399 addTestSource(''' | 412 await addTestSource(''' |
| 400 class C2 { | 413 class C2 { |
| 401 // normal ^comment | 414 // normal ^comment |
| 402 zoo(z) { } String name; }'''); | 415 zoo(z) { } String name; }'''); |
| 403 assertTarget('// normal comment', 'class C2 {zoo(z) {} String name;}'); | 416 await assertTarget( |
| 404 } | 417 '// normal comment', 'class C2 {zoo(z) {} String name;}'); |
| 405 | 418 } |
| 406 test_MethodDeclaration_inLineComment3() { | 419 |
| 420 test_MethodDeclaration_inLineComment3() async { | |
| 407 // Comment ClassDeclaration CompilationUnit | 421 // Comment ClassDeclaration CompilationUnit |
| 408 addTestSource(''' | 422 await addTestSource(''' |
| 409 class C2 { | 423 class C2 { |
| 410 // normal comment ^ | 424 // normal comment ^ |
| 411 // normal comment 2 | 425 // normal comment 2 |
| 412 zoo(z) { } String name; }'''); | 426 zoo(z) { } String name; }'''); |
| 413 assertTarget('// normal comment ', 'class C2 {zoo(z) {} String name;}'); | 427 await assertTarget( |
| 414 } | 428 '// normal comment ', 'class C2 {zoo(z) {} String name;}'); |
| 415 | 429 } |
| 416 test_MethodDeclaration_inLineComment4() { | 430 |
| 431 test_MethodDeclaration_inLineComment4() async { | |
| 417 // Comment ClassDeclaration CompilationUnit | 432 // Comment ClassDeclaration CompilationUnit |
| 418 addTestSource(''' | 433 await addTestSource(''' |
| 419 class C2 { | 434 class C2 { |
| 420 // normal comment | 435 // normal comment |
| 421 // normal comment 2^ | 436 // normal comment 2^ |
| 422 zoo(z) { } String name; }'''); | 437 zoo(z) { } String name; }'''); |
| 423 assertTarget('// normal comment 2', 'class C2 {zoo(z) {} String name;}'); | 438 await assertTarget( |
| 424 } | 439 '// normal comment 2', 'class C2 {zoo(z) {} String name;}'); |
| 425 | 440 } |
| 426 test_MethodDeclaration_inLineDocComment() { | 441 |
| 442 test_MethodDeclaration_inLineDocComment() async { | |
| 427 // Comment MethodDeclaration ClassDeclaration CompilationUnit | 443 // Comment MethodDeclaration ClassDeclaration CompilationUnit |
| 428 addTestSource(''' | 444 await addTestSource(''' |
| 429 class C2 { | 445 class C2 { |
| 430 /// some dartdoc ^ | 446 /// some dartdoc ^ |
| 431 zoo(z) { } String name; }'''); | 447 zoo(z) { } String name; }'''); |
| 432 assertTarget('/// some dartdoc ', ''); | 448 await assertTarget('/// some dartdoc ', ''); |
| 433 expect(target.containingNode is Comment, isTrue); | 449 expect(target.containingNode is Comment, isTrue); |
| 434 expect(target.containingNode.parent.toSource(), 'zoo(z) {}'); | 450 expect(target.containingNode.parent.toSource(), 'zoo(z) {}'); |
| 435 } | 451 } |
| 436 | 452 |
| 437 test_MethodDeclaration_inLineDocComment2() { | 453 test_MethodDeclaration_inLineDocComment2() async { |
| 438 // Comment MethodDeclaration ClassDeclaration CompilationUnit | 454 // Comment MethodDeclaration ClassDeclaration CompilationUnit |
| 439 addTestSource(''' | 455 await addTestSource(''' |
| 440 class C2 { | 456 class C2 { |
| 441 /// some ^dartdoc | 457 /// some ^dartdoc |
| 442 zoo(z) { } String name; }'''); | 458 zoo(z) { } String name; }'''); |
| 443 assertTarget('/// some dartdoc', ''); | 459 await assertTarget('/// some dartdoc', ''); |
| 444 expect(target.containingNode is Comment, isTrue); | 460 expect(target.containingNode is Comment, isTrue); |
| 445 expect(target.containingNode.parent.toSource(), 'zoo(z) {}'); | 461 expect(target.containingNode.parent.toSource(), 'zoo(z) {}'); |
| 446 } | 462 } |
| 447 | 463 |
| 448 test_MethodDeclaration_inStarComment() { | 464 test_MethodDeclaration_inStarComment() async { |
| 449 // Comment ClassDeclaration CompilationUnit | 465 // Comment ClassDeclaration CompilationUnit |
| 450 addTestSource('class C2 {/* ^ */ zoo(z) {} String name;}'); | 466 await addTestSource('class C2 {/* ^ */ zoo(z) {} String name;}'); |
| 451 assertTarget('/* */', 'class C2 {zoo(z) {} String name;}'); | 467 await assertTarget('/* */', 'class C2 {zoo(z) {} String name;}'); |
| 452 } | 468 } |
| 453 | 469 |
| 454 test_MethodDeclaration_inStarComment2() { | 470 test_MethodDeclaration_inStarComment2() async { |
| 455 // Comment ClassDeclaration CompilationUnit | 471 // Comment ClassDeclaration CompilationUnit |
| 456 addTestSource('class C2 {/* *^/ zoo(z) {} String name;}'); | 472 await addTestSource('class C2 {/* *^/ zoo(z) {} String name;}'); |
| 457 assertTarget('/* */', 'class C2 {zoo(z) {} String name;}'); | 473 await assertTarget('/* */', 'class C2 {zoo(z) {} String name;}'); |
| 458 } | 474 } |
| 459 | 475 |
| 460 test_MethodDeclaration_inStarDocComment() { | 476 test_MethodDeclaration_inStarDocComment() async { |
| 461 // Comment MethodDeclaration ClassDeclaration CompilationUnit | 477 // Comment MethodDeclaration ClassDeclaration CompilationUnit |
| 462 addTestSource('class C2 {/** ^ */ zoo(z) { } String name; }'); | 478 await addTestSource('class C2 {/** ^ */ zoo(z) { } String name; }'); |
| 463 assertTarget('/** */', ''); | 479 await assertTarget('/** */', ''); |
| 464 expect(target.containingNode is Comment, isTrue); | 480 expect(target.containingNode is Comment, isTrue); |
| 465 expect(target.containingNode.parent.toSource(), 'zoo(z) {}'); | 481 expect(target.containingNode.parent.toSource(), 'zoo(z) {}'); |
| 466 } | 482 } |
| 467 | 483 |
| 468 test_MethodDeclaration_inStarDocComment2() { | 484 test_MethodDeclaration_inStarDocComment2() async { |
| 469 // Comment MethodDeclaration ClassDeclaration CompilationUnit | 485 // Comment MethodDeclaration ClassDeclaration CompilationUnit |
| 470 addTestSource('class C2 {/** *^/ zoo(z) { } String name; }'); | 486 await addTestSource('class C2 {/** *^/ zoo(z) { } String name; }'); |
| 471 assertTarget('/** */', ''); | 487 await assertTarget('/** */', ''); |
| 472 expect(target.containingNode is Comment, isTrue); | 488 expect(target.containingNode is Comment, isTrue); |
| 473 expect(target.containingNode.parent.toSource(), 'zoo(z) {}'); | 489 expect(target.containingNode.parent.toSource(), 'zoo(z) {}'); |
| 474 } | 490 } |
| 475 | 491 |
| 476 test_MethodDeclaration_returnType() { | 492 test_MethodDeclaration_returnType() async { |
| 477 // ClassDeclaration CompilationUnit | 493 // ClassDeclaration CompilationUnit |
| 478 addTestSource('class C2 {^ zoo(z) { } String name; }'); | 494 await addTestSource('class C2 {^ zoo(z) { } String name; }'); |
| 479 assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}'); | 495 await assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}'); |
| 480 } | 496 } |
| 481 | 497 |
| 482 test_MethodDeclaration_returnType_afterLineComment() { | 498 test_MethodDeclaration_returnType_afterLineComment() async { |
| 483 // MethodDeclaration ClassDeclaration CompilationUnit | 499 // MethodDeclaration ClassDeclaration CompilationUnit |
| 484 addTestSource(''' | 500 await addTestSource(''' |
| 485 class C2 { | 501 class C2 { |
| 486 // normal comment | 502 // normal comment |
| 487 ^ zoo(z) {} String name;}'''); | 503 ^ zoo(z) {} String name;}'''); |
| 488 assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}'); | 504 await assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}'); |
| 489 } | 505 } |
| 490 | 506 |
| 491 test_MethodDeclaration_returnType_afterLineComment2() { | 507 test_MethodDeclaration_returnType_afterLineComment2() async { |
| 492 // MethodDeclaration ClassDeclaration CompilationUnit | 508 // MethodDeclaration ClassDeclaration CompilationUnit |
| 493 // TOD(danrubel) left align all test source | 509 // TOD(danrubel) left align all test source |
| 494 addTestSource(''' | 510 await addTestSource(''' |
| 495 class C2 { | 511 class C2 { |
| 496 // normal comment | 512 // normal comment |
| 497 ^ zoo(z) {} String name;}'''); | 513 ^ zoo(z) {} String name;}'''); |
| 498 assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}'); | 514 await assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}'); |
| 499 } | 515 } |
| 500 | 516 |
| 501 test_MethodDeclaration_returnType_afterLineDocComment() { | 517 test_MethodDeclaration_returnType_afterLineDocComment() async { |
| 502 // SimpleIdentifier MethodDeclaration ClassDeclaration CompilationUnit | 518 // SimpleIdentifier MethodDeclaration ClassDeclaration CompilationUnit |
| 503 addTestSource(''' | 519 await addTestSource(''' |
| 504 class C2 { | 520 class C2 { |
| 505 /// some dartdoc | 521 /// some dartdoc |
| 506 ^ zoo(z) { } String name; }'''); | 522 ^ zoo(z) { } String name; }'''); |
| 507 assertTarget('zoo', 'zoo(z) {}'); | 523 await assertTarget('zoo', 'zoo(z) {}'); |
| 508 } | 524 } |
| 509 | 525 |
| 510 test_MethodDeclaration_returnType_afterLineDocComment2() { | 526 test_MethodDeclaration_returnType_afterLineDocComment2() async { |
| 511 // SimpleIdentifier MethodDeclaration ClassDeclaration CompilationUnit | 527 // SimpleIdentifier MethodDeclaration ClassDeclaration CompilationUnit |
| 512 addTestSource(''' | 528 await addTestSource(''' |
| 513 class C2 { | 529 class C2 { |
| 514 /// some dartdoc | 530 /// some dartdoc |
| 515 ^ zoo(z) { } String name; }'''); | 531 ^ zoo(z) { } String name; }'''); |
| 516 assertTarget('zoo', 'zoo(z) {}'); | 532 await assertTarget('zoo', 'zoo(z) {}'); |
| 517 } | 533 } |
| 518 | 534 |
| 519 test_MethodDeclaration_returnType_afterStarComment() { | 535 test_MethodDeclaration_returnType_afterStarComment() async { |
| 520 // ClassDeclaration CompilationUnit | 536 // ClassDeclaration CompilationUnit |
| 521 addTestSource('class C2 {/* */ ^ zoo(z) { } String name; }'); | 537 await addTestSource('class C2 {/* */ ^ zoo(z) { } String name; }'); |
| 522 assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}'); | 538 await assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}'); |
| 523 } | 539 } |
| 524 | 540 |
| 525 test_MethodDeclaration_returnType_afterStarComment2() { | 541 test_MethodDeclaration_returnType_afterStarComment2() async { |
| 526 // ClassDeclaration CompilationUnit | 542 // ClassDeclaration CompilationUnit |
| 527 addTestSource('class C2 {/* */^ zoo(z) { } String name; }'); | 543 await addTestSource('class C2 {/* */^ zoo(z) { } String name; }'); |
| 528 assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}'); | 544 await assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}'); |
| 529 } | 545 } |
| 530 | 546 |
| 531 test_MethodDeclaration_returnType_afterStarDocComment() { | 547 test_MethodDeclaration_returnType_afterStarDocComment() async { |
| 532 // MethodDeclaration ClassDeclaration CompilationUnit | 548 // MethodDeclaration ClassDeclaration CompilationUnit |
| 533 addTestSource('class C2 {/** */ ^ zoo(z) { } String name; }'); | 549 await addTestSource('class C2 {/** */ ^ zoo(z) { } String name; }'); |
| 534 assertTarget('zoo', 'zoo(z) {}'); | 550 await assertTarget('zoo', 'zoo(z) {}'); |
| 535 } | 551 } |
| 536 | 552 |
| 537 test_MethodDeclaration_returnType_afterStarDocComment2() { | 553 test_MethodDeclaration_returnType_afterStarDocComment2() async { |
| 538 // MethodDeclaration ClassDeclaration CompilationUnit | 554 // MethodDeclaration ClassDeclaration CompilationUnit |
| 539 addTestSource('class C2 {/** */^ zoo(z) { } String name; }'); | 555 await addTestSource('class C2 {/** */^ zoo(z) { } String name; }'); |
| 540 assertTarget('zoo', 'zoo(z) {}'); | 556 await assertTarget('zoo', 'zoo(z) {}'); |
| 541 } | 557 } |
| 542 | 558 |
| 543 test_SwitchStatement_c() { | 559 test_SwitchStatement_c() async { |
| 544 // Token('c') SwitchStatement | 560 // Token('c') SwitchStatement |
| 545 addTestSource('main() { switch(x) {c^} }'); | 561 await addTestSource('main() { switch(x) {c^} }'); |
| 546 assertTarget('}', 'switch (x) {}'); | 562 await assertTarget('}', 'switch (x) {}'); |
| 547 } | 563 } |
| 548 | 564 |
| 549 test_SwitchStatement_c2() { | 565 test_SwitchStatement_c2() async { |
| 550 // Token('c') SwitchStatement | 566 // Token('c') SwitchStatement |
| 551 addTestSource('main() { switch(x) { c^ } }'); | 567 await addTestSource('main() { switch(x) { c^ } }'); |
| 552 assertTarget('}', 'switch (x) {}'); | 568 await assertTarget('}', 'switch (x) {}'); |
| 553 } | 569 } |
| 554 | 570 |
| 555 test_SwitchStatement_empty() { | 571 test_SwitchStatement_empty() async { |
| 556 // SwitchStatement | 572 // SwitchStatement |
| 557 addTestSource('main() { switch(x) {^} }'); | 573 await addTestSource('main() { switch(x) {^} }'); |
| 558 assertTarget('}', 'switch (x) {}'); | 574 await assertTarget('}', 'switch (x) {}'); |
| 559 } | 575 } |
| 560 | 576 |
| 561 test_SwitchStatement_empty2() { | 577 test_SwitchStatement_empty2() async { |
| 562 // SwitchStatement | 578 // SwitchStatement |
| 563 addTestSource('main() { switch(x) { ^ } }'); | 579 await addTestSource('main() { switch(x) { ^ } }'); |
| 564 assertTarget('}', 'switch (x) {}'); | 580 await assertTarget('}', 'switch (x) {}'); |
| 565 } | 581 } |
| 566 | 582 |
| 567 test_TypeArgumentList() { | 583 test_TypeArgumentList() async { |
| 568 // TypeName TypeArgumentList TypeName | 584 // TypeName TypeArgumentList TypeName |
| 569 addTestSource('main() { C<^> c; }'); | 585 await addTestSource('main() { C<^> c; }'); |
| 570 assertTarget('', '<>'); | 586 await assertTarget('', '<>'); |
| 571 } | 587 } |
| 572 | 588 |
| 573 test_TypeArgumentList2() { | 589 test_TypeArgumentList2() async { |
| 574 // TypeName TypeArgumentList TypeName | 590 // TypeName TypeArgumentList TypeName |
| 575 addTestSource('main() { C<C^> c; }'); | 591 await addTestSource('main() { C<C^> c; }'); |
| 576 assertTarget('C', '<C>'); | 592 await assertTarget('C', '<C>'); |
| 577 } | 593 } |
| 578 | 594 |
| 579 test_VariableDeclaration_lhs_identifier_after() { | 595 test_VariableDeclaration_lhs_identifier_after() async { |
| 580 // VariableDeclaration VariableDeclarationList | 596 // VariableDeclaration VariableDeclarationList |
| 581 addTestSource('main() {int b^ = 1;}'); | 597 await addTestSource('main() {int b^ = 1;}'); |
| 582 assertTarget('b = 1', 'int b = 1'); | 598 await assertTarget('b = 1', 'int b = 1'); |
| 583 } | 599 } |
| 584 | 600 |
| 585 test_VariableDeclaration_lhs_identifier_before() { | 601 test_VariableDeclaration_lhs_identifier_before() async { |
| 586 // VariableDeclaration VariableDeclarationList | 602 // VariableDeclaration VariableDeclarationList |
| 587 addTestSource('main() {int ^b = 1;}'); | 603 await addTestSource('main() {int ^b = 1;}'); |
| 588 assertTarget('b = 1', 'int b = 1'); | 604 await assertTarget('b = 1', 'int b = 1'); |
| 589 } | 605 } |
| 590 } | 606 } |
| OLD | NEW |