OLD | NEW |
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 import 'package:analysis_server/protocol/protocol.dart'; | 5 import 'package:analysis_server/protocol/protocol.dart'; |
6 import 'package:analysis_server/protocol/protocol_generated.dart'; | 6 import 'package:analysis_server/protocol/protocol_generated.dart'; |
7 import 'package:analysis_server/src/domain_analysis.dart'; | 7 import 'package:analysis_server/src/domain_analysis.dart'; |
8 import 'package:analyzer/src/dart/analysis/driver.dart'; | 8 import 'package:analyzer/src/dart/analysis/driver.dart'; |
9 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; | 9 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; |
10 import 'package:test/test.dart'; | 10 import 'package:test/test.dart'; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 test_fileNotInAnalysisRoot() async { | 58 test_fileNotInAnalysisRoot() async { |
59 String path = '/other/file.dart'; | 59 String path = '/other/file.dart'; |
60 addFile(path, ''); | 60 addFile(path, ''); |
61 await _setPriorityFile(path); | 61 await _setPriorityFile(path); |
62 _verifyPriorityFiles(path); | 62 _verifyPriorityFiles(path); |
63 } | 63 } |
64 | 64 |
65 test_ignoredInAnalysisOptions() async { | 65 test_ignoredInAnalysisOptions() async { |
66 String sampleFile = '$projectPath/samples/sample.dart'; | 66 String sampleFile = '$projectPath/samples/sample.dart'; |
67 addFile( | 67 addFile('$projectPath/.analysis_options', r''' |
68 '$projectPath/.analysis_options', | |
69 r''' | |
70 analyzer: | 68 analyzer: |
71 exclude: | 69 exclude: |
72 - 'samples/**' | 70 - 'samples/**' |
73 '''); | 71 '''); |
74 addFile(sampleFile, ''); | 72 addFile(sampleFile, ''); |
75 // attempt to set priority file | 73 // attempt to set priority file |
76 await _setPriorityFile(sampleFile); | 74 await _setPriorityFile(sampleFile); |
77 _verifyPriorityFiles(sampleFile); | 75 _verifyPriorityFiles(sampleFile); |
78 } | 76 } |
79 | 77 |
80 test_ignoredInAnalysisOptions_inChildContext() async { | 78 test_ignoredInAnalysisOptions_inChildContext() async { |
81 addFile('$projectPath/.packages', ''); | 79 addFile('$projectPath/.packages', ''); |
82 addFile('$projectPath/child/.packages', ''); | 80 addFile('$projectPath/child/.packages', ''); |
83 String sampleFile = '$projectPath/child/samples/sample.dart'; | 81 String sampleFile = '$projectPath/child/samples/sample.dart'; |
84 addFile( | 82 addFile('$projectPath/child/.analysis_options', r''' |
85 '$projectPath/child/.analysis_options', | |
86 r''' | |
87 analyzer: | 83 analyzer: |
88 exclude: | 84 exclude: |
89 - 'samples/**' | 85 - 'samples/**' |
90 '''); | 86 '''); |
91 addFile(sampleFile, ''); | 87 addFile(sampleFile, ''); |
92 // attempt to set priority file | 88 // attempt to set priority file |
93 await _setPriorityFile(sampleFile); | 89 await _setPriorityFile(sampleFile); |
94 _verifyPriorityFiles(sampleFile); | 90 _verifyPriorityFiles(sampleFile); |
95 } | 91 } |
96 | 92 |
97 test_ignoredInAnalysisOptions_inRootContext() async { | 93 test_ignoredInAnalysisOptions_inRootContext() async { |
98 addFile('$projectPath/.packages', ''); | 94 addFile('$projectPath/.packages', ''); |
99 addFile('$projectPath/child/.packages', ''); | 95 addFile('$projectPath/child/.packages', ''); |
100 String sampleFile = '$projectPath/child/samples/sample.dart'; | 96 String sampleFile = '$projectPath/child/samples/sample.dart'; |
101 addFile( | 97 addFile('$projectPath/.analysis_options', r''' |
102 '$projectPath/.analysis_options', | |
103 r''' | |
104 analyzer: | 98 analyzer: |
105 exclude: | 99 exclude: |
106 - 'child/samples/**' | 100 - 'child/samples/**' |
107 '''); | 101 '''); |
108 addFile(sampleFile, ''); | 102 addFile(sampleFile, ''); |
109 // attempt to set priority file | 103 // attempt to set priority file |
110 await _setPriorityFile(sampleFile); | 104 await _setPriorityFile(sampleFile); |
111 _verifyPriorityFiles(sampleFile); | 105 _verifyPriorityFiles(sampleFile); |
112 } | 106 } |
113 | 107 |
(...skipping 14 matching lines...) Expand all Loading... |
128 new AnalysisSetPriorityFilesParams(<String>[file]).toRequest('0'); | 122 new AnalysisSetPriorityFilesParams(<String>[file]).toRequest('0'); |
129 return await serverChannel.sendRequest(request); | 123 return await serverChannel.sendRequest(request); |
130 } | 124 } |
131 | 125 |
132 void _verifyPriorityFiles(String path) { | 126 void _verifyPriorityFiles(String path) { |
133 AnalysisDriver driver = server.getAnalysisDriver(path); | 127 AnalysisDriver driver = server.getAnalysisDriver(path); |
134 List<String> prioritySources = driver.priorityFiles; | 128 List<String> prioritySources = driver.priorityFiles; |
135 expect(prioritySources, [path]); | 129 expect(prioritySources, [path]); |
136 } | 130 } |
137 } | 131 } |
OLD | NEW |