OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.format; | 5 library test.edit.format; |
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/plugin/server_plugin.dart'; | |
11 import 'package:analysis_server/src/protocol.dart'; | 10 import 'package:analysis_server/src/protocol.dart'; |
12 import 'package:plugin/manager.dart'; | 11 import 'package:plugin/manager.dart'; |
13 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 12 import 'package:test_reflective_loader/test_reflective_loader.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 import '../mocks.dart'; | 16 import '../mocks.dart'; |
18 | 17 |
19 main() { | 18 main() { |
20 groupSep = ' | '; | 19 groupSep = ' | '; |
21 defineReflectiveTests(FormatTest); | 20 defineReflectiveTests(FormatTest); |
22 } | 21 } |
23 | 22 |
24 @reflectiveTest | 23 @reflectiveTest |
25 class FormatTest extends AbstractAnalysisTest { | 24 class FormatTest extends AbstractAnalysisTest { |
26 @override | 25 @override |
27 void setUp() { | 26 void setUp() { |
28 super.setUp(); | 27 super.setUp(); |
29 createProject(); | 28 createProject(); |
30 ExtensionManager manager = new ExtensionManager(); | 29 ExtensionManager manager = new ExtensionManager(); |
31 ServerPlugin plugin = new ServerPlugin(); | 30 manager.processPlugins([server.serverPlugin]); |
32 manager.processPlugins([plugin]); | 31 handler = new EditDomainHandler(server); |
33 handler = new EditDomainHandler(server, plugin); | |
34 } | 32 } |
35 | 33 |
36 Future test_formatNoOp() { | 34 Future test_formatNoOp() { |
37 // Already formatted source | 35 // Already formatted source |
38 addTestFile(''' | 36 addTestFile(''' |
39 main() { | 37 main() { |
40 int x = 3; | 38 int x = 3; |
41 } | 39 } |
42 '''); | 40 '''); |
43 return waitForTasksFinished().then((_) { | 41 return waitForTasksFinished().then((_) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 }); | 97 }); |
100 } | 98 } |
101 | 99 |
102 EditFormatResult _formatAt(int selectionOffset, int selectionLength) { | 100 EditFormatResult _formatAt(int selectionOffset, int selectionLength) { |
103 Request request = new EditFormatParams( | 101 Request request = new EditFormatParams( |
104 testFile, selectionOffset, selectionLength).toRequest('0'); | 102 testFile, selectionOffset, selectionLength).toRequest('0'); |
105 Response response = handleSuccessfulRequest(request); | 103 Response response = handleSuccessfulRequest(request); |
106 return new EditFormatResult.fromResponse(response); | 104 return new EditFormatResult.fromResponse(response); |
107 } | 105 } |
108 } | 106 } |
OLD | NEW |