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

Side by Side Diff: pkg/analysis_server/test/analysis/set_priority_files_test.dart

Issue 1462693002: Report error for ignored priority file. Ignore subscription for ignored files. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.analysis.set_priority_files; 5 library test.analysis.set_priority_files;
6 6
7 import 'package:analysis_server/plugin/protocol/protocol.dart'; 7 import 'package:analysis_server/plugin/protocol/protocol.dart';
8 import 'package:analysis_server/src/domain_analysis.dart'; 8 import 'package:analysis_server/src/domain_analysis.dart';
9 import 'package:analyzer/src/generated/engine.dart' 9 import 'package:analyzer/src/generated/engine.dart'
10 show InternalAnalysisContext; 10 show InternalAnalysisContext;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 test_fileNotInAnalysisRoot() async { 67 test_fileNotInAnalysisRoot() async {
68 String path = '/other/file.dart'; 68 String path = '/other/file.dart';
69 addFile(path, ''); 69 addFile(path, '');
70 Response response = await _setPriorityFile(path); 70 Response response = await _setPriorityFile(path);
71 expect(response.error, isNotNull); 71 expect(response.error, isNotNull);
72 expect(response.error.code, RequestErrorCode.UNANALYZED_PRIORITY_FILES); 72 expect(response.error.code, RequestErrorCode.UNANALYZED_PRIORITY_FILES);
73 } 73 }
74 74
75 test_ignoredInAnalysisOptions() async {
76 String sampleFile = '$projectPath/samples/sample.dart';
77 addFile(
78 '$projectPath/.analysis_options',
79 r'''
80 analyzer:
81 exclude:
82 - 'samples/**'
83 ''');
84 addFile(sampleFile, '');
85 // attempt to set priority file
86 Response response = await _setPriorityFile(sampleFile);
87 expect(response.error, isNotNull);
88 expect(response.error.code, RequestErrorCode.UNANALYZED_PRIORITY_FILES);
89 }
90
91 test_ignoredInAnalysisOptions_inChildContext() async {
92 addFile('$projectPath/.packages', '');
93 addFile('$projectPath/child/.packages', '');
94 String sampleFile = '$projectPath/child/samples/sample.dart';
95 addFile(
96 '$projectPath/child/.analysis_options',
97 r'''
98 analyzer:
99 exclude:
100 - 'samples/**'
101 ''');
102 addFile(sampleFile, '');
103 // attempt to set priority file
104 Response response = await _setPriorityFile(sampleFile);
105 expect(response.error, isNotNull);
106 expect(response.error.code, RequestErrorCode.UNANALYZED_PRIORITY_FILES);
107 }
108
109 test_ignoredInAnalysisOptions_inRootContext() async {
110 addFile('$projectPath/.packages', '');
111 addFile('$projectPath/child/.packages', '');
112 String sampleFile = '$projectPath/child/samples/sample.dart';
113 addFile(
114 '$projectPath/.analysis_options',
115 r'''
116 analyzer:
117 exclude:
118 - 'child/samples/**'
119 ''');
120 addFile(sampleFile, '');
121 // attempt to set priority file
122 Response response = await _setPriorityFile(sampleFile);
123 expect(response.error, isNotNull);
124 expect(response.error.code, RequestErrorCode.UNANALYZED_PRIORITY_FILES);
125 }
126
75 _setPriorityFile(String file) async { 127 _setPriorityFile(String file) async {
76 Request request = 128 Request request =
77 new AnalysisSetPriorityFilesParams(<String>[file]).toRequest('0'); 129 new AnalysisSetPriorityFilesParams(<String>[file]).toRequest('0');
78 return await serverChannel.sendRequest(request); 130 return await serverChannel.sendRequest(request);
79 } 131 }
80 } 132 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698