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

Side by Side Diff: pkg/analysis_server/test/edit/fixes_test.dart

Issue 574573002: Add SourceFileEdit.time field. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: tweak Created 6 years, 3 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/edit/edit_domain.dart'; 9 import 'package:analysis_server/src/edit/edit_domain.dart';
10 import 'package:analysis_server/src/protocol.dart'; 10 import 'package:analysis_server/src/protocol.dart';
11 import '../reflective_tests.dart';
12 import 'package:unittest/unittest.dart' hide ERROR; 11 import 'package:unittest/unittest.dart' hide ERROR;
13 12
14 import '../analysis_abstract.dart'; 13 import '../analysis_abstract.dart';
14 import '../reflective_tests.dart';
15 15
16 16
17 main() { 17 main() {
18 groupSep = ' | '; 18 groupSep = ' | ';
19 runReflectiveTests(FixesTest); 19 runReflectiveTests(FixesTest);
20 } 20 }
21 21
22 22
23 @ReflectiveTestCase() 23 @ReflectiveTestCase()
24 class FixesTest extends AbstractAnalysisTest { 24 class FixesTest extends AbstractAnalysisTest {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // print(10) 67 // print(10)
68 { 68 {
69 List<AnalysisErrorFixes> errorFixes = _getFixesAt('print(10)'); 69 List<AnalysisErrorFixes> errorFixes = _getFixesAt('print(10)');
70 expect(errorFixes, hasLength(2)); 70 expect(errorFixes, hasLength(2));
71 _isSyntacticErrorWithSingleFix(errorFixes[0]); 71 _isSyntacticErrorWithSingleFix(errorFixes[0]);
72 _isSyntacticErrorWithSingleFix(errorFixes[1]); 72 _isSyntacticErrorWithSingleFix(errorFixes[1]);
73 } 73 }
74 }); 74 });
75 } 75 }
76 76
77 void _isSyntacticErrorWithSingleFix(AnalysisErrorFixes fixes) { 77 List<AnalysisErrorFixes> _getFixes(int offset) {
78 AnalysisError error = fixes.error; 78 Request request = new EditGetFixesParams(testFile, offset).toRequest('0');
79 expect(error.severity, AnalysisErrorSeverity.ERROR); 79 Response response = handleSuccessfulRequest(request);
80 expect(error.type, AnalysisErrorType.SYNTACTIC_ERROR); 80 var result = new EditGetFixesResult.fromResponse(response);
81 expect(fixes.fixes, hasLength(1)); 81 return result.fixes;
82 } 82 }
83 83
84 List<AnalysisErrorFixes> _getFixesAt(String search) { 84 List<AnalysisErrorFixes> _getFixesAt(String search) {
85 int offset = findOffset(search); 85 int offset = findOffset(search);
86 return _getFixes(offset); 86 return _getFixes(offset);
87 } 87 }
88 88
89 89
90 List<AnalysisErrorFixes> _getFixes(int offset) { 90 void _isSyntacticErrorWithSingleFix(AnalysisErrorFixes fixes) {
91 Request request = new EditGetFixesParams(testFile, offset).toRequest('0'); 91 AnalysisError error = fixes.error;
92 Response response = handleSuccessfulRequest(request); 92 expect(error.severity, AnalysisErrorSeverity.ERROR);
93 var result = new EditGetFixesResult.fromResponse(response); 93 expect(error.type, AnalysisErrorType.SYNTACTIC_ERROR);
94 return result.fixes; 94 expect(fixes.fixes, hasLength(1));
95 } 95 }
96 } 96 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/edit/assists_test.dart ('k') | pkg/analysis_server/test/integration/protocol_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698