@@ -171,4 +171,58 @@ suite("Integration Test Suite: Copybooks", function () {
171
171
} )
172
172
. timeout ( helper . TEST_TIMEOUT )
173
173
. slow ( 1000 ) ;
174
+
175
+ suite ( "Default copybook configuration" , ( ) => {
176
+ suite ( "default configuration - local configuration path not set" , ( ) => {
177
+ suiteSetup ( async ( ) => {
178
+ await helper . updateConfig ( "default.json" ) ;
179
+ await helper . activate ( ) ;
180
+ } ) ;
181
+
182
+ test ( "Local copybooks are resolved from local subfolders if no configuration is provided" , async ( ) => {
183
+ const editor = await helper . showDocument ( "USERC1N1.cbl" ) ;
184
+
185
+ let diagnostics : vscode . Diagnostic [ ] = [ ] ;
186
+ await helper . waitFor ( ( ) => {
187
+ diagnostics = vscode . languages . getDiagnostics ( editor . document . uri ) ;
188
+ return (
189
+ diagnostics . length > 0 &&
190
+ diagnostics . some ( ( d ) => d . message === "Errors inside the copybook" )
191
+ ) ;
192
+ } ) ;
193
+
194
+ assert . strictEqual (
195
+ diagnostics . filter ( ( d ) => d . message === "BOOK1N: Copybook not found" )
196
+ . length ,
197
+ 0 ,
198
+ ) ;
199
+ } ) ;
200
+ } ) ;
201
+
202
+ suite ( "local copybook path is configured" , ( ) => {
203
+ suiteSetup ( async ( ) => {
204
+ await helper . updateConfig ( "testing.json" ) ;
205
+ await helper . activate ( ) ;
206
+ } ) ;
207
+
208
+ test ( "Only folder from configuration is used for local copybook resolution" , async ( ) => {
209
+ const editor = await helper . showDocument ( "USERC1N1.cbl" ) ;
210
+
211
+ let diagnostics : vscode . Diagnostic [ ] = [ ] ;
212
+ await helper . waitFor ( ( ) => {
213
+ diagnostics = vscode . languages . getDiagnostics ( editor . document . uri ) ;
214
+ return (
215
+ diagnostics . length > 0 &&
216
+ diagnostics . some ( ( d ) => d . message === "BOOK1N: Copybook not found" )
217
+ ) ;
218
+ } ) ;
219
+
220
+ assert . strictEqual (
221
+ diagnostics . filter ( ( d ) => d . message === "BOOK1N: Copybook not found" )
222
+ . length ,
223
+ 1 ,
224
+ ) ;
225
+ } ) ;
226
+ } ) ;
227
+ } ) ;
174
228
} ) ;
0 commit comments