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

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

Issue 2700563003: Add tests for edit.sortMembers and edit.organizeDirectives. (Closed)
Patch Set: Created 3 years, 10 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 'package:analysis_server/plugin/protocol/protocol.dart';
6 import 'package:test/test.dart';
7 import 'package:test_reflective_loader/test_reflective_loader.dart';
8
9 import '../integration_tests.dart';
10
11 main() {
12 defineReflectiveSuite(() {
13 defineReflectiveTests(OrganizeDirectivesTest);
14 });
15 }
16
17 @reflectiveTest
18 class OrganizeDirectivesTest extends AbstractAnalysisServerIntegrationTest {
19 test_organize_directives() async {
20 String pathname = sourcePath('test.dart');
21 String text = r'''
22 import 'dart:math';
23 import 'dart:async';
24
25 Future foo;
26 int minified(int x, int y) => min(x, y);
27 ''';
28 writeFile(pathname, text);
29 standardAnalysisSetup();
30
31 EditOrganizeDirectivesResult result = await sendEditOrganizeDirectives(pathn ame);
32 SourceFileEdit edit = result.edit;
33 expect(edit.edits, hasLength(1));
34 expect(edit.edits.first.replacement, "import 'dart:async';\nimport 'dart:mat h");
35 }
36
37 test_organize_directives_no_changes() async {
38 String pathname = sourcePath('test.dart');
39 String text = r'''
40 import 'dart:async';
41 import 'dart:math';
42
43 Future foo;
44 int minified(int x, int y) => min(x, y);
45 ''';
46 writeFile(pathname, text);
47 standardAnalysisSetup();
48
49 EditOrganizeDirectivesResult result = await sendEditOrganizeDirectives(pathn ame);
50 SourceFileEdit edit = result.edit;
51 expect(edit.edits, isEmpty);
52 }
53
54 test_organize_directives_with_errors() async {
55 String pathname = sourcePath('test.dart');
56 String text = r'''
57 import 'dart:async'
58 import 'dart:math';
59
60 Future foo;
61 int minified(int x, int y) => min(x, y);
62 ''';
63 writeFile(pathname, text);
64 standardAnalysisSetup();
65
66 try {
67 await sendEditOrganizeDirectives(pathname);
68 } on ServerErrorMessage catch (message) {
69 expect(message.error['code'], 'ORGANIZE_DIRECTIVES_ERROR');
70 }
71 }
72
73 @override
74 bool get enableNewAnalysisDriver => true;
75 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/integration/coverage.md ('k') | pkg/analysis_server/test/integration/edit/sort_members_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698