| 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.edit.fixes; | 5 library test.edit.fixes; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/constants.dart'; | |
| 10 import 'package:analysis_server/src/edit/edit_domain.dart'; | 9 import 'package:analysis_server/src/edit/edit_domain.dart'; |
| 11 import 'package:analysis_server/src/protocol.dart'; | 10 import 'package:analysis_server/src/protocol.dart'; |
| 12 import 'package:analysis_server/src/protocol2.dart'; | 11 import 'package:analysis_server/src/protocol2.dart'; |
| 13 import 'package:analysis_testing/reflective_tests.dart'; | 12 import 'package:analysis_testing/reflective_tests.dart'; |
| 14 import 'package:unittest/unittest.dart' hide ERROR; | 13 import 'package:unittest/unittest.dart' hide ERROR; |
| 15 | 14 |
| 16 import '../analysis_abstract.dart'; | 15 import '../analysis_abstract.dart'; |
| 17 | 16 |
| 18 | 17 |
| 19 main() { | 18 main() { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 34 Future test_hasFixes() { | 33 Future test_hasFixes() { |
| 35 addTestFile(''' | 34 addTestFile(''' |
| 36 main() { | 35 main() { |
| 37 print(42) | 36 print(42) |
| 38 } | 37 } |
| 39 '''); | 38 '''); |
| 40 return waitForTasksFinished().then((_) { | 39 return waitForTasksFinished().then((_) { |
| 41 Request request = new EditGetFixesParams(testFile, | 40 Request request = new EditGetFixesParams(testFile, |
| 42 findOffset('print')).toRequest('0'); | 41 findOffset('print')).toRequest('0'); |
| 43 Response response = handleSuccessfulRequest(request); | 42 Response response = handleSuccessfulRequest(request); |
| 44 List<Map<String, Object>> errorFixesJsonList = response.getResult(FIXES); | 43 var result = new EditGetFixesResult.fromResponse(response); |
| 45 expect(errorFixesJsonList, hasLength(1)); | 44 List<ErrorFixes> errorFixes = result.fixes; |
| 45 expect(errorFixes, hasLength(1)); |
| 46 { | 46 { |
| 47 Map<String, Object> fixes = errorFixesJsonList[0]; | 47 ErrorFixes fixes = errorFixes[0]; |
| 48 Map<String, Object> error = fixes[ERROR]; | 48 AnalysisError error = fixes.error; |
| 49 expect(error[SEVERITY], 'ERROR'); | 49 expect(error.severity, ErrorSeverity.ERROR); |
| 50 expect(error[TYPE], 'SYNTACTIC_ERROR'); | 50 expect(error.type, ErrorType.SYNTACTIC_ERROR); |
| 51 expect(fixes[FIXES], hasLength(1)); | 51 expect(fixes.fixes, hasLength(1)); |
| 52 } | 52 } |
| 53 }); | 53 }); |
| 54 } | 54 } |
| 55 } | 55 } |
| OLD | NEW |