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

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

Issue 2746333008: Run dartfmt on dart2js codebase. (Closed)
Patch Set: Format all analyzer packages Created 3 years, 9 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
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 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 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 import 'package:analysis_server/plugin/protocol/protocol.dart'; 5 import 'package:analysis_server/plugin/protocol/protocol.dart';
6 import 'package:test/test.dart'; 6 import 'package:test/test.dart';
7 import 'package:test_reflective_loader/test_reflective_loader.dart'; 7 import 'package:test_reflective_loader/test_reflective_loader.dart';
8 8
9 import '../integration_tests.dart'; 9 import '../integration_tests.dart';
10 10
(...skipping 10 matching lines...) Expand all
21 String text = r''' 21 String text = r'''
22 import 'dart:math'; 22 import 'dart:math';
23 import 'dart:async'; 23 import 'dart:async';
24 24
25 Future foo; 25 Future foo;
26 int minified(int x, int y) => min(x, y); 26 int minified(int x, int y) => min(x, y);
27 '''; 27 ''';
28 writeFile(pathname, text); 28 writeFile(pathname, text);
29 standardAnalysisSetup(); 29 standardAnalysisSetup();
30 30
31 EditOrganizeDirectivesResult result = await sendEditOrganizeDirectives(pathn ame); 31 EditOrganizeDirectivesResult result =
32 await sendEditOrganizeDirectives(pathname);
32 SourceFileEdit edit = result.edit; 33 SourceFileEdit edit = result.edit;
33 expect(edit.edits, hasLength(1)); 34 expect(edit.edits, hasLength(1));
34 expect(edit.edits.first.replacement, "import 'dart:async';\nimport 'dart:mat h"); 35 expect(edit.edits.first.replacement,
36 "import 'dart:async';\nimport 'dart:math");
35 } 37 }
36 38
37 test_organize_directives_no_changes() async { 39 test_organize_directives_no_changes() async {
38 String pathname = sourcePath('test.dart'); 40 String pathname = sourcePath('test.dart');
39 String text = r''' 41 String text = r'''
40 import 'dart:async'; 42 import 'dart:async';
41 import 'dart:math'; 43 import 'dart:math';
42 44
43 Future foo; 45 Future foo;
44 int minified(int x, int y) => min(x, y); 46 int minified(int x, int y) => min(x, y);
45 '''; 47 ''';
46 writeFile(pathname, text); 48 writeFile(pathname, text);
47 standardAnalysisSetup(); 49 standardAnalysisSetup();
48 50
49 EditOrganizeDirectivesResult result = await sendEditOrganizeDirectives(pathn ame); 51 EditOrganizeDirectivesResult result =
52 await sendEditOrganizeDirectives(pathname);
50 SourceFileEdit edit = result.edit; 53 SourceFileEdit edit = result.edit;
51 expect(edit.edits, isEmpty); 54 expect(edit.edits, isEmpty);
52 } 55 }
53 56
54 test_organize_directives_with_errors() async { 57 test_organize_directives_with_errors() async {
55 String pathname = sourcePath('test.dart'); 58 String pathname = sourcePath('test.dart');
56 String text = r''' 59 String text = r'''
57 import 'dart:async' 60 import 'dart:async'
58 import 'dart:math'; 61 import 'dart:math';
59 62
60 Future foo; 63 Future foo;
61 int minified(int x, int y) => min(x, y); 64 int minified(int x, int y) => min(x, y);
62 '''; 65 ''';
63 writeFile(pathname, text); 66 writeFile(pathname, text);
64 standardAnalysisSetup(); 67 standardAnalysisSetup();
65 68
66 try { 69 try {
67 await sendEditOrganizeDirectives(pathname); 70 await sendEditOrganizeDirectives(pathname);
68 } on ServerErrorMessage catch (message) { 71 } on ServerErrorMessage catch (message) {
69 expect(message.error['code'], 'ORGANIZE_DIRECTIVES_ERROR'); 72 expect(message.error['code'], 'ORGANIZE_DIRECTIVES_ERROR');
70 } 73 }
71 } 74 }
72 75
73 @override 76 @override
74 bool get enableNewAnalysisDriver => true; 77 bool get enableNewAnalysisDriver => true;
75 } 78 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698