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

Side by Side Diff: pkg/analysis_server/test/src/computer/import_elements_computer_test.dart

Issue 2975253002: Format analyzer, analysis_server, analyzer_plugin, front_end and kernel with the latest dartfmt. (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
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/protocol/protocol_generated.dart'; 5 import 'package:analysis_server/protocol/protocol_generated.dart';
6 import 'package:analysis_server/src/computer/import_elements_computer.dart'; 6 import 'package:analysis_server/src/computer/import_elements_computer.dart';
7 import 'package:analyzer/dart/analysis/results.dart'; 7 import 'package:analyzer/dart/analysis/results.dart';
8 import 'package:analyzer_plugin/protocol/protocol_common.dart'; 8 import 'package:analyzer_plugin/protocol/protocol_common.dart';
9 import 'package:test/test.dart'; 9 import 'package:test/test.dart';
10 import 'package:test_reflective_loader/test_reflective_loader.dart'; 10 import 'package:test_reflective_loader/test_reflective_loader.dart';
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 List<ImportedElements> elements = <ImportedElements>[ 48 List<ImportedElements> elements = <ImportedElements>[
49 new ImportedElements(provider.convertPath('/p/lib/a.dart'), 49 new ImportedElements(provider.convertPath('/p/lib/a.dart'),
50 'package:p/a.dart', '', <String>['A']), 50 'package:p/a.dart', '', <String>['A']),
51 ]; 51 ];
52 List<SourceEdit> edits = _computeEditsFor(elements); 52 List<SourceEdit> edits = _computeEditsFor(elements);
53 expect(edits, hasLength(1)); 53 expect(edits, hasLength(1));
54 SourceEdit edit = edits[0]; 54 SourceEdit edit = edits[0];
55 expect(edit, isNotNull); 55 expect(edit, isNotNull);
56 expect(edit.offset, 0); 56 expect(edit.offset, 0);
57 expect(edit.length, 0); 57 expect(edit.length, 0);
58 expect( 58 expect(edit.apply(targetCode), """
59 edit.apply(targetCode),
60 """
61 import 'source.dart'; 59 import 'source.dart';
62 60
63 main() {} 61 main() {}
64 """); 62 """);
65 } 63 }
66 64
67 test_none_none() { 65 test_none_none() {
68 List<ImportedElements> elements = <ImportedElements>[]; 66 List<ImportedElements> elements = <ImportedElements>[];
69 List<SourceEdit> edits = _computeEditsFor(elements); 67 List<SourceEdit> edits = _computeEditsFor(elements);
70 expect(edits, hasLength(0)); 68 expect(edits, hasLength(0));
71 } 69 }
72 70
73 List<SourceEdit> _computeEditsFor(List<ImportedElements> elements) { 71 List<SourceEdit> _computeEditsFor(List<ImportedElements> elements) {
74 ImportElementsComputer computer = 72 ImportElementsComputer computer =
75 new ImportElementsComputer(result, targetPath, elements); 73 new ImportElementsComputer(result, targetPath, elements);
76 return computer.compute(); 74 return computer.compute();
77 } 75 }
78 } 76 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/services/search/search_engine_test.dart ('k') | pkg/analyzer/test/dart/element/builder_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698