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

Side by Side Diff: pkg/analysis_server/test/integration/edit/import_elements_test.dart

Issue 2972833002: Initial implementation of copy/paste support (Closed)
Patch Set: Created 3 years, 5 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
OLDNEW
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
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.
4
5 import 'dart:async';
6
7 import 'package:analysis_server/protocol/protocol_generated.dart';
8 import 'package:analyzer_plugin/protocol/protocol_common.dart';
9 import 'package:test/test.dart';
10 import 'package:test_reflective_loader/test_reflective_loader.dart';
11
12 import '../support/integration_tests.dart';
13
14 main() {
15 defineReflectiveSuite(() {
16 defineReflectiveTests(AnalysisGetImportElementsIntegrationTest);
17 });
18 }
19
20 @reflectiveTest
21 class AnalysisGetImportElementsIntegrationTest
22 extends AbstractAnalysisServerIntegrationTest {
23 /**
24 * Pathname of the file containing Dart code.
25 */
26 String pathname;
27
28 /**
29 * Dart code under test.
30 */
31 final String text = r'''
32 ''';
33
34 /**
35 * Check that an edit.importElements request with the given list of [elements]
36 * produces the [expected] list of edits.
37 */
38 checkEdits(List<ImportedElements> elements, List<SourceEdit> expected) async {
39 EditImportElementsResult result =
40 await sendEditImportElements(pathname, elements);
41
42 expect(result.edits, hasLength(expected.length));
43 // TODO(brianwilkerson) Finish implementing this.
44 }
45
46 /**
47 * Check that an edit.importElements request with the given list of [elements]
48 * produces no edits.
49 */
50 Future<Null> checkNoEdits(List<ImportedElements> elements) async {
51 EditImportElementsResult result =
52 await sendEditImportElements(pathname, <ImportedElements>[]);
53
54 expect(result.edits, hasLength(0));
55 }
56
57 setUp() {
58 return super.setUp().then((_) {
59 pathname = sourcePath('test.dart');
60 });
61 }
62
63 test_getImportedElements() async {
64 writeFile(pathname, text);
65 standardAnalysisSetup();
66 await analysisFinished;
67
68 List<Future> tests = [];
69 // Test that an empty list of elements produces no edits.
70 tests.add(checkNoEdits(<ImportedElements>[]));
71 return Future.wait(tests);
72 }
73 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698