| 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.correction.assist; | 5 library test.services.correction.assist; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; | 9 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; |
| 10 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 10 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| (...skipping 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2372 test_introduceLocalTestedType_BAD_notIsExpression() async { | 2372 test_introduceLocalTestedType_BAD_notIsExpression() async { |
| 2373 resolveTestUnit(''' | 2373 resolveTestUnit(''' |
| 2374 main(p) { | 2374 main(p) { |
| 2375 if (p == null) { | 2375 if (p == null) { |
| 2376 } | 2376 } |
| 2377 } | 2377 } |
| 2378 '''); | 2378 '''); |
| 2379 await assertNoAssistAt('if (p', DartAssistKind.INTRODUCE_LOCAL_CAST_TYPE); | 2379 await assertNoAssistAt('if (p', DartAssistKind.INTRODUCE_LOCAL_CAST_TYPE); |
| 2380 } | 2380 } |
| 2381 | 2381 |
| 2382 test_introduceLocalTestedType_BAD_notStatement() async { |
| 2383 resolveTestUnit(''' |
| 2384 class C { |
| 2385 bool b; |
| 2386 C(v) : b = v is int; |
| 2387 }'''); |
| 2388 await assertNoAssistAt('is int', DartAssistKind.INTRODUCE_LOCAL_CAST_TYPE); |
| 2389 } |
| 2390 |
| 2382 test_introduceLocalTestedType_OK_if_is() async { | 2391 test_introduceLocalTestedType_OK_if_is() async { |
| 2383 resolveTestUnit(''' | 2392 resolveTestUnit(''' |
| 2384 class MyTypeName {} | 2393 class MyTypeName {} |
| 2385 main(p) { | 2394 main(p) { |
| 2386 if (p is MyTypeName) { | 2395 if (p is MyTypeName) { |
| 2387 } | 2396 } |
| 2388 p = null; | 2397 p = null; |
| 2389 } | 2398 } |
| 2390 '''); | 2399 '''); |
| 2391 String expected = ''' | 2400 String expected = ''' |
| (...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3946 positions.add(new Position(testFile, offset)); | 3955 positions.add(new Position(testFile, offset)); |
| 3947 } | 3956 } |
| 3948 return positions; | 3957 return positions; |
| 3949 } | 3958 } |
| 3950 | 3959 |
| 3951 void _setStartEndSelection() { | 3960 void _setStartEndSelection() { |
| 3952 offset = findOffset('// start\n') + '// start\n'.length; | 3961 offset = findOffset('// start\n') + '// start\n'.length; |
| 3953 length = findOffset('// end') - offset; | 3962 length = findOffset('// end') - offset; |
| 3954 } | 3963 } |
| 3955 } | 3964 } |
| OLD | NEW |