| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analysis_server/protocol/protocol.dart'; | 7 import 'package:analysis_server/protocol/protocol.dart'; |
| 8 import 'package:analysis_server/protocol/protocol_generated.dart'; | 8 import 'package:analysis_server/protocol/protocol_generated.dart'; |
| 9 import 'package:analysis_server/src/constants.dart'; | 9 import 'package:analysis_server/src/constants.dart'; |
| 10 import 'package:analysis_server/src/services/index/index.dart'; | 10 import 'package:analysis_server/src/services/index/index.dart'; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 void setUp() { | 119 void setUp() { |
| 120 super.setUp(); | 120 super.setUp(); |
| 121 createProject(); | 121 createProject(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void subscribeForImplemented() { | 124 void subscribeForImplemented() { |
| 125 addAnalysisSubscription(AnalysisService.IMPLEMENTED, testFile); | 125 addAnalysisSubscription(AnalysisService.IMPLEMENTED, testFile); |
| 126 } | 126 } |
| 127 | 127 |
| 128 @failingTest | |
| 129 test_afterAnalysis() async { | 128 test_afterAnalysis() async { |
| 130 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 131 fail('The analysis.implemented notification is not implemented.'); | |
| 132 addTestFile(''' | 129 addTestFile(''' |
| 133 class A {} | 130 class A {} |
| 134 class B extends A {} | 131 class B extends A {} |
| 135 '''); | 132 '''); |
| 136 await waitForTasksFinished(); | 133 await waitForTasksFinished(); |
| 137 await prepareImplementedElements(); | 134 await prepareImplementedElements(); |
| 138 assertHasImplementedClass('A {'); | 135 assertHasImplementedClass('A {'); |
| 139 } | 136 } |
| 140 | 137 |
| 141 @failingTest | |
| 142 test_afterIncrementalResolution() async { | 138 test_afterIncrementalResolution() async { |
| 143 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 144 fail('The analysis.implemented notification is not implemented.'); | |
| 145 subscribeForImplemented(); | 139 subscribeForImplemented(); |
| 146 addTestFile(''' | 140 addTestFile(''' |
| 147 class A {} | 141 class A {} |
| 148 class B extends A {} | 142 class B extends A {} |
| 149 '''); | 143 '''); |
| 150 await prepareImplementedElements(); | 144 await prepareImplementedElements(); |
| 151 assertHasImplementedClass('A {'); | 145 assertHasImplementedClass('A {'); |
| 152 // add a space | 146 // add a space |
| 153 implementedClasses = null; | 147 implementedClasses = null; |
| 154 testCode = ''' | 148 testCode = ''' |
| 155 class A {} | 149 class A {} |
| 156 class B extends A {} | 150 class B extends A {} |
| 157 '''; | 151 '''; |
| 158 server.updateContent('1', {testFile: new AddContentOverlay(testCode)}); | 152 server.updateContent('1', {testFile: new AddContentOverlay(testCode)}); |
| 159 await waitForImplementedElements(); | 153 await waitForImplementedElements(); |
| 160 assertHasImplementedClass('A {'); | 154 assertHasImplementedClass('A {'); |
| 161 } | 155 } |
| 162 | 156 |
| 163 @failingTest | |
| 164 test_class_extended() async { | 157 test_class_extended() async { |
| 165 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 166 fail('The analysis.implemented notification is not implemented.'); | |
| 167 addTestFile(''' | 158 addTestFile(''' |
| 168 class A {} | 159 class A {} |
| 169 class B extends A {} | 160 class B extends A {} |
| 170 '''); | 161 '''); |
| 171 await prepareImplementedElements(); | 162 await prepareImplementedElements(); |
| 172 assertHasImplementedClass('A {'); | 163 assertHasImplementedClass('A {'); |
| 173 } | 164 } |
| 174 | 165 |
| 175 @failingTest | |
| 176 test_class_implemented() async { | 166 test_class_implemented() async { |
| 177 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 178 fail('The analysis.implemented notification is not implemented.'); | |
| 179 addTestFile(''' | 167 addTestFile(''' |
| 180 class A {} | 168 class A {} |
| 181 class B implements A {} | 169 class B implements A {} |
| 182 '''); | 170 '''); |
| 183 await prepareImplementedElements(); | 171 await prepareImplementedElements(); |
| 184 assertHasImplementedClass('A {'); | 172 assertHasImplementedClass('A {'); |
| 185 } | 173 } |
| 186 | 174 |
| 187 @failingTest | |
| 188 test_class_mixed() async { | 175 test_class_mixed() async { |
| 189 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 190 fail('The analysis.implemented notification is not implemented.'); | |
| 191 addTestFile(''' | 176 addTestFile(''' |
| 192 class A {} | 177 class A {} |
| 193 class B = Object with A; | 178 class B = Object with A; |
| 194 '''); | 179 '''); |
| 195 await prepareImplementedElements(); | 180 await prepareImplementedElements(); |
| 196 assertHasImplementedClass('A {'); | 181 assertHasImplementedClass('A {'); |
| 197 } | 182 } |
| 198 | 183 |
| 199 @failingTest | |
| 200 test_field_withField() async { | 184 test_field_withField() async { |
| 201 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 202 fail('The analysis.implemented notification is not implemented.'); | |
| 203 addTestFile(''' | 185 addTestFile(''' |
| 204 class A { | 186 class A { |
| 205 int f; // A | 187 int f; // A |
| 206 } | 188 } |
| 207 class B extends A { | 189 class B extends A { |
| 208 int f; | 190 int f; |
| 209 } | 191 } |
| 210 '''); | 192 '''); |
| 211 await prepareImplementedElements(); | 193 await prepareImplementedElements(); |
| 212 assertHasImplementedMember('f; // A'); | 194 assertHasImplementedMember('f; // A'); |
| 213 } | 195 } |
| 214 | 196 |
| 215 @failingTest | |
| 216 test_field_withGetter() async { | 197 test_field_withGetter() async { |
| 217 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 218 fail('The analysis.implemented notification is not implemented.'); | |
| 219 addTestFile(''' | 198 addTestFile(''' |
| 220 class A { | 199 class A { |
| 221 int f; // A | 200 int f; // A |
| 222 } | 201 } |
| 223 class B extends A { | 202 class B extends A { |
| 224 get f => null; | 203 get f => null; |
| 225 } | 204 } |
| 226 '''); | 205 '''); |
| 227 await prepareImplementedElements(); | 206 await prepareImplementedElements(); |
| 228 assertHasImplementedMember('f; // A'); | 207 assertHasImplementedMember('f; // A'); |
| 229 } | 208 } |
| 230 | 209 |
| 231 @failingTest | |
| 232 test_field_withSetter() async { | 210 test_field_withSetter() async { |
| 233 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 234 fail('The analysis.implemented notification is not implemented.'); | |
| 235 addTestFile(''' | 211 addTestFile(''' |
| 236 class A { | 212 class A { |
| 237 int f; // A | 213 int f; // A |
| 238 } | 214 } |
| 239 class B extends A { | 215 class B extends A { |
| 240 void set f(_) {} | 216 void set f(_) {} |
| 241 } | 217 } |
| 242 '''); | 218 '''); |
| 243 await prepareImplementedElements(); | 219 await prepareImplementedElements(); |
| 244 assertHasImplementedMember('f; // A'); | 220 assertHasImplementedMember('f; // A'); |
| 245 } | 221 } |
| 246 | 222 |
| 247 @failingTest | |
| 248 test_getter_withField() async { | 223 test_getter_withField() async { |
| 249 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 250 fail('The analysis.implemented notification is not implemented.'); | |
| 251 addTestFile(''' | 224 addTestFile(''' |
| 252 class A { | 225 class A { |
| 253 get f => null; // A | 226 get f => null; // A |
| 254 } | 227 } |
| 255 class B extends A { | 228 class B extends A { |
| 256 int f; | 229 int f; |
| 257 } | 230 } |
| 258 '''); | 231 '''); |
| 259 await prepareImplementedElements(); | 232 await prepareImplementedElements(); |
| 260 assertHasImplementedMember('f => null; // A'); | 233 assertHasImplementedMember('f => null; // A'); |
| 261 } | 234 } |
| 262 | 235 |
| 263 @failingTest | |
| 264 test_getter_withGetter() async { | 236 test_getter_withGetter() async { |
| 265 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 266 fail('The analysis.implemented notification is not implemented.'); | |
| 267 addTestFile(''' | 237 addTestFile(''' |
| 268 class A { | 238 class A { |
| 269 get f => null; // A | 239 get f => null; // A |
| 270 } | 240 } |
| 271 class B extends A { | 241 class B extends A { |
| 272 get f => null; | 242 get f => null; |
| 273 } | 243 } |
| 274 '''); | 244 '''); |
| 275 await prepareImplementedElements(); | 245 await prepareImplementedElements(); |
| 276 assertHasImplementedMember('f => null; // A'); | 246 assertHasImplementedMember('f => null; // A'); |
| 277 } | 247 } |
| 278 | 248 |
| 279 @failingTest | |
| 280 test_method_withMethod() async { | 249 test_method_withMethod() async { |
| 281 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 282 fail('The analysis.implemented notification is not implemented.'); | |
| 283 addTestFile(''' | 250 addTestFile(''' |
| 284 class A { | 251 class A { |
| 285 m() {} // A | 252 m() {} // A |
| 286 } | 253 } |
| 287 class B extends A { | 254 class B extends A { |
| 288 m() {} // B | 255 m() {} // B |
| 289 } | 256 } |
| 290 '''); | 257 '''); |
| 291 await prepareImplementedElements(); | 258 await prepareImplementedElements(); |
| 292 assertHasImplementedMember('m() {} // A'); | 259 assertHasImplementedMember('m() {} // A'); |
| 293 assertNoImplementedMember('m() {} // B'); | 260 assertNoImplementedMember('m() {} // B'); |
| 294 } | 261 } |
| 295 | 262 |
| 296 @failingTest | |
| 297 test_method_withMethod_indirectSubclass() async { | 263 test_method_withMethod_indirectSubclass() async { |
| 298 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 299 fail('The analysis.implemented notification is not implemented.'); | |
| 300 addTestFile(''' | 264 addTestFile(''' |
| 301 class A { | 265 class A { |
| 302 m() {} // A | 266 m() {} // A |
| 303 } | 267 } |
| 304 class B extends A { | 268 class B extends A { |
| 305 } | 269 } |
| 306 class C extends A { | 270 class C extends A { |
| 307 m() {} | 271 m() {} |
| 308 } | 272 } |
| 309 '''); | 273 '''); |
| 310 await prepareImplementedElements(); | 274 await prepareImplementedElements(); |
| 311 assertHasImplementedMember('m() {} // A'); | 275 assertHasImplementedMember('m() {} // A'); |
| 312 } | 276 } |
| 313 | 277 |
| 314 @failingTest | |
| 315 test_method_withMethod_private_differentLib() async { | 278 test_method_withMethod_private_differentLib() async { |
| 316 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 317 fail('The analysis.implemented notification is not implemented.'); | |
| 318 addFile( | 279 addFile( |
| 319 '$testFolder/lib.dart', | 280 '$testFolder/lib.dart', |
| 320 r''' | 281 r''' |
| 321 import 'test.dart'; | 282 import 'test.dart'; |
| 322 class B extends A { | 283 class B extends A { |
| 323 void _m() {} | 284 void _m() {} |
| 324 } | 285 } |
| 325 '''); | 286 '''); |
| 326 addTestFile(''' | 287 addTestFile(''' |
| 327 class A { | 288 class A { |
| 328 _m() {} // A | 289 _m() {} // A |
| 329 } | 290 } |
| 330 '''); | 291 '''); |
| 331 await prepareImplementedElements(); | 292 await prepareImplementedElements(); |
| 332 assertNoImplementedMember('_m() {} // A'); | 293 assertNoImplementedMember('_m() {} // A'); |
| 333 } | 294 } |
| 334 | 295 |
| 335 @failingTest | |
| 336 test_method_withMethod_private_sameLibrary() async { | 296 test_method_withMethod_private_sameLibrary() async { |
| 337 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 338 fail('The analysis.implemented notification is not implemented.'); | |
| 339 addTestFile(''' | 297 addTestFile(''' |
| 340 class A { | 298 class A { |
| 341 _m() {} // A | 299 _m() {} // A |
| 342 } | 300 } |
| 343 class B extends A { | 301 class B extends A { |
| 344 _m() {} // B | 302 _m() {} // B |
| 345 } | 303 } |
| 346 '''); | 304 '''); |
| 347 await prepareImplementedElements(); | 305 await prepareImplementedElements(); |
| 348 assertHasImplementedMember('_m() {} // A'); | 306 assertHasImplementedMember('_m() {} // A'); |
| 349 assertNoImplementedMember('_m() {} // B'); | 307 assertNoImplementedMember('_m() {} // B'); |
| 350 } | 308 } |
| 351 | 309 |
| 352 @failingTest | |
| 353 test_method_withMethod_wasAbstract() async { | 310 test_method_withMethod_wasAbstract() async { |
| 354 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 355 fail('The analysis.implemented notification is not implemented.'); | |
| 356 addTestFile(''' | 311 addTestFile(''' |
| 357 abstract class A { | 312 abstract class A { |
| 358 m(); // A | 313 m(); // A |
| 359 } | 314 } |
| 360 class B extends A { | 315 class B extends A { |
| 361 m() {} | 316 m() {} |
| 362 } | 317 } |
| 363 '''); | 318 '''); |
| 364 await prepareImplementedElements(); | 319 await prepareImplementedElements(); |
| 365 assertHasImplementedMember('m(); // A'); | 320 assertHasImplementedMember('m(); // A'); |
| 366 } | 321 } |
| 367 | 322 |
| 368 @failingTest | |
| 369 test_setter_withField() async { | 323 test_setter_withField() async { |
| 370 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 371 fail('The analysis.implemented notification is not implemented.'); | |
| 372 addTestFile(''' | 324 addTestFile(''' |
| 373 class A { | 325 class A { |
| 374 set f(_) {} // A | 326 set f(_) {} // A |
| 375 } | 327 } |
| 376 class B extends A { | 328 class B extends A { |
| 377 int f; | 329 int f; |
| 378 } | 330 } |
| 379 '''); | 331 '''); |
| 380 await prepareImplementedElements(); | 332 await prepareImplementedElements(); |
| 381 assertHasImplementedMember('f(_) {} // A'); | 333 assertHasImplementedMember('f(_) {} // A'); |
| 382 } | 334 } |
| 383 | 335 |
| 384 @failingTest | |
| 385 test_setter_withSetter() async { | 336 test_setter_withSetter() async { |
| 386 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 387 fail('The analysis.implemented notification is not implemented.'); | |
| 388 addTestFile(''' | 337 addTestFile(''' |
| 389 class A { | 338 class A { |
| 390 set f(_) {} // A | 339 set f(_) {} // A |
| 391 } | 340 } |
| 392 class B extends A { | 341 class B extends A { |
| 393 set f(_) {} // B | 342 set f(_) {} // B |
| 394 } | 343 } |
| 395 '''); | 344 '''); |
| 396 await prepareImplementedElements(); | 345 await prepareImplementedElements(); |
| 397 assertHasImplementedMember('f(_) {} // A'); | 346 assertHasImplementedMember('f(_) {} // A'); |
| 398 } | 347 } |
| 399 | 348 |
| 400 @failingTest | |
| 401 test_static_field_instanceStatic() async { | 349 test_static_field_instanceStatic() async { |
| 402 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 403 fail('The analysis.implemented notification is not implemented.'); | |
| 404 addTestFile(''' | 350 addTestFile(''' |
| 405 class A { | 351 class A { |
| 406 int F = 0; | 352 int F = 0; |
| 407 } | 353 } |
| 408 class B extends A { | 354 class B extends A { |
| 409 static int F = 1; | 355 static int F = 1; |
| 410 } | 356 } |
| 411 '''); | 357 '''); |
| 412 await prepareImplementedElements(); | 358 await prepareImplementedElements(); |
| 413 assertNoImplementedMember('F = 0'); | 359 assertNoImplementedMember('F = 0'); |
| 414 } | 360 } |
| 415 | 361 |
| 416 @failingTest | |
| 417 test_static_field_staticInstance() async { | 362 test_static_field_staticInstance() async { |
| 418 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 419 fail('The analysis.implemented notification is not implemented.'); | |
| 420 addTestFile(''' | 363 addTestFile(''' |
| 421 class A { | 364 class A { |
| 422 static int F = 0; | 365 static int F = 0; |
| 423 } | 366 } |
| 424 class B extends A { | 367 class B extends A { |
| 425 int F = 1; | 368 int F = 1; |
| 426 } | 369 } |
| 427 '''); | 370 '''); |
| 428 await prepareImplementedElements(); | 371 await prepareImplementedElements(); |
| 429 assertNoImplementedMember('F = 0'); | 372 assertNoImplementedMember('F = 0'); |
| 430 } | 373 } |
| 431 | 374 |
| 432 @failingTest | |
| 433 test_static_field_staticStatic() async { | 375 test_static_field_staticStatic() async { |
| 434 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 435 fail('The analysis.implemented notification is not implemented.'); | |
| 436 addTestFile(''' | 376 addTestFile(''' |
| 437 class A { | 377 class A { |
| 438 static int F = 0; | 378 static int F = 0; |
| 439 } | 379 } |
| 440 class B extends A { | 380 class B extends A { |
| 441 static int F = 1; | 381 static int F = 1; |
| 442 } | 382 } |
| 443 '''); | 383 '''); |
| 444 await prepareImplementedElements(); | 384 await prepareImplementedElements(); |
| 445 assertNoImplementedMember('F = 0'); | 385 assertNoImplementedMember('F = 0'); |
| 446 } | 386 } |
| 447 | 387 |
| 448 @failingTest | |
| 449 test_static_method_instanceStatic() async { | 388 test_static_method_instanceStatic() async { |
| 450 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 451 fail('The analysis.implemented notification is not implemented.'); | |
| 452 addTestFile(''' | 389 addTestFile(''' |
| 453 class A { | 390 class A { |
| 454 int m() => 0; | 391 int m() => 0; |
| 455 } | 392 } |
| 456 class B extends A { | 393 class B extends A { |
| 457 static int m() => 1; | 394 static int m() => 1; |
| 458 } | 395 } |
| 459 '''); | 396 '''); |
| 460 await prepareImplementedElements(); | 397 await prepareImplementedElements(); |
| 461 assertNoImplementedMember('m() => 0'); | 398 assertNoImplementedMember('m() => 0'); |
| 462 } | 399 } |
| 463 | 400 |
| 464 @failingTest | |
| 465 test_static_method_staticInstance() async { | 401 test_static_method_staticInstance() async { |
| 466 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 467 fail('The analysis.implemented notification is not implemented.'); | |
| 468 addTestFile(''' | 402 addTestFile(''' |
| 469 class A { | 403 class A { |
| 470 static int m() => 0; | 404 static int m() => 0; |
| 471 } | 405 } |
| 472 class B extends A { | 406 class B extends A { |
| 473 int m() => 1; | 407 int m() => 1; |
| 474 } | 408 } |
| 475 '''); | 409 '''); |
| 476 await prepareImplementedElements(); | 410 await prepareImplementedElements(); |
| 477 assertNoImplementedMember('m() => 0'); | 411 assertNoImplementedMember('m() => 0'); |
| 478 } | 412 } |
| 479 | 413 |
| 480 @failingTest | |
| 481 test_static_method_staticStatic() async { | 414 test_static_method_staticStatic() async { |
| 482 // See https://github.com/dart-lang/sdk/issues/29113 | |
| 483 fail('The analysis.implemented notification is not implemented.'); | |
| 484 addTestFile(''' | 415 addTestFile(''' |
| 485 class A { | 416 class A { |
| 486 static int m() => 0; | 417 static int m() => 0; |
| 487 } | 418 } |
| 488 class B extends A { | 419 class B extends A { |
| 489 static int m() => 1; | 420 static int m() => 1; |
| 490 } | 421 } |
| 491 '''); | 422 '''); |
| 492 await prepareImplementedElements(); | 423 await prepareImplementedElements(); |
| 493 assertNoImplementedMember('m() => 0'); | 424 assertNoImplementedMember('m() => 0'); |
| 494 } | 425 } |
| 495 | 426 |
| 496 Future waitForImplementedElements() { | 427 Future waitForImplementedElements() { |
| 497 Future waitForNotification(int times) { | 428 Future waitForNotification(int times) { |
| 498 if (times == 0 || implementedClasses != null) { | 429 if (times == 0 || implementedClasses != null) { |
| 499 return new Future.value(); | 430 return new Future.value(); |
| 500 } | 431 } |
| 501 return new Future.delayed( | 432 return new Future.delayed( |
| 502 new Duration(milliseconds: 1), () => waitForNotification(times - 1)); | 433 new Duration(milliseconds: 1), () => waitForNotification(times - 1)); |
| 503 } | 434 } |
| 504 | 435 |
| 505 return waitForNotification(30000); | 436 return waitForNotification(30000); |
| 506 } | 437 } |
| 507 } | 438 } |
| OLD | NEW |