@@ -17,17 +17,6 @@ import {
17
17
isReplyErrorIndexPath ,
18
18
readReplyErrorIndex ,
19
19
} from "./reply.js" ;
20
- import {
21
- TargetV2_0 ,
22
- TargetV2_1 ,
23
- TargetV2_2 ,
24
- TargetV2_5 ,
25
- TargetV2_6 ,
26
- TargetV2_7 ,
27
- TargetV2_8 ,
28
- CmakeFilesV1_0 ,
29
- CmakeFilesV1_1 ,
30
- } from "./schemas.js" ;
31
20
32
21
function createTempDir ( context : TestContext , prefix = "test-" ) {
33
22
const tmpPath = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , prefix ) ) ;
@@ -261,158 +250,6 @@ describe("readCodeModel", () => {
261
250
} ) ;
262
251
263
252
describe ( "readTarget" , ( ) => {
264
- it ( "reads a well-formed target file" , async function ( context ) {
265
- const mockTarget = {
266
- name : "MyExecutable" ,
267
- id : "MyExecutable::@6890a9b7b1a1a2e4d6b9" ,
268
- type : "EXECUTABLE" ,
269
- backtrace : 1 ,
270
- folder : {
271
- name : "Executables" ,
272
- } ,
273
- paths : {
274
- source : "." ,
275
- build : "." ,
276
- } ,
277
- nameOnDisk : "MyExecutable" ,
278
- artifacts : [
279
- {
280
- path : "MyExecutable" ,
281
- } ,
282
- ] ,
283
- isGeneratorProvided : false ,
284
- install : {
285
- prefix : {
286
- path : "/usr/local" ,
287
- } ,
288
- destinations : [
289
- {
290
- path : "bin" ,
291
- backtrace : 2 ,
292
- } ,
293
- ] ,
294
- } ,
295
- launchers : [
296
- {
297
- command : "/usr/bin/gdb" ,
298
- arguments : [ "--args" ] ,
299
- type : "test" ,
300
- } ,
301
- ] ,
302
- link : {
303
- language : "CXX" ,
304
- commandFragments : [
305
- {
306
- fragment : "-O3" ,
307
- role : "flags" ,
308
- backtrace : 3 ,
309
- } ,
310
- ] ,
311
- lto : false ,
312
- sysroot : {
313
- path : "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" ,
314
- } ,
315
- } ,
316
- dependencies : [
317
- {
318
- id : "MyLibrary::@6890a9b7b1a1a2e4d6b9" ,
319
- backtrace : 4 ,
320
- } ,
321
- ] ,
322
- fileSets : [
323
- {
324
- name : "HEADERS" ,
325
- type : "HEADERS" ,
326
- visibility : "PUBLIC" ,
327
- baseDirectories : [ "." ] ,
328
- } ,
329
- ] ,
330
- sources : [
331
- {
332
- path : "main.cpp" ,
333
- compileGroupIndex : 0 ,
334
- sourceGroupIndex : 0 ,
335
- isGenerated : false ,
336
- fileSetIndex : 0 ,
337
- backtrace : 5 ,
338
- } ,
339
- ] ,
340
- sourceGroups : [
341
- {
342
- name : "Source Files" ,
343
- sourceIndexes : [ 0 ] ,
344
- } ,
345
- ] ,
346
- compileGroups : [
347
- {
348
- sourceIndexes : [ 0 ] ,
349
- language : "CXX" ,
350
- languageStandard : {
351
- backtraces : [ 6 ] ,
352
- standard : "17" ,
353
- } ,
354
- compileCommandFragments : [
355
- {
356
- fragment : "-std=c++17" ,
357
- backtrace : 7 ,
358
- } ,
359
- ] ,
360
- includes : [
361
- {
362
- path : "/usr/include" ,
363
- isSystem : true ,
364
- backtrace : 8 ,
365
- } ,
366
- ] ,
367
- frameworks : [
368
- {
369
- path : "/System/Library/Frameworks/Foundation.framework" ,
370
- isSystem : true ,
371
- backtrace : 9 ,
372
- } ,
373
- ] ,
374
- precompileHeaders : [
375
- {
376
- header : "pch.h" ,
377
- backtrace : 10 ,
378
- } ,
379
- ] ,
380
- defines : [
381
- {
382
- define : "NDEBUG" ,
383
- backtrace : 11 ,
384
- } ,
385
- ] ,
386
- sysroot : {
387
- path : "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" ,
388
- } ,
389
- } ,
390
- ] ,
391
- backtraceGraph : {
392
- nodes : [
393
- {
394
- file : 0 ,
395
- line : 1 ,
396
- command : 0 ,
397
- parent : null ,
398
- } ,
399
- ] ,
400
- commands : [ "add_executable" ] ,
401
- files : [ "CMakeLists.txt" ] ,
402
- } ,
403
- } ;
404
-
405
- const tmpPath = createMockReplyDirectory ( context , [
406
- [ "target-MyExecutable.json" , mockTarget ] ,
407
- ] ) ;
408
- const result = await readTarget (
409
- path . join ( tmpPath , "target-MyExecutable.json" ) ,
410
- ) ;
411
-
412
- // Verify the entire structure matches our mock data
413
- assert . deepStrictEqual ( result , mockTarget ) ;
414
- } ) ;
415
-
416
253
// Base objects for reusable test data
417
254
const baseTarget = {
418
255
name : "MyTarget" ,
@@ -461,7 +298,7 @@ describe("readTarget", () => {
461
298
] ) ;
462
299
const result = await readTarget (
463
300
path . join ( tmpPath , "target-v2_0.json" ) ,
464
- TargetV2_0 ,
301
+ "2.0" ,
465
302
) ;
466
303
467
304
assert . deepStrictEqual ( result , targetV2_0 ) ;
@@ -489,7 +326,7 @@ describe("readTarget", () => {
489
326
] ) ;
490
327
const result = await readTarget (
491
328
path . join ( tmpPath , "target-v2_1.json" ) ,
492
- TargetV2_1 ,
329
+ "2.1" ,
493
330
) ;
494
331
495
332
assert . deepStrictEqual ( result , targetV2_1 ) ;
@@ -521,7 +358,7 @@ describe("readTarget", () => {
521
358
] ) ;
522
359
const result = await readTarget (
523
360
path . join ( tmpPath , "target-v2_2.json" ) ,
524
- TargetV2_2 ,
361
+ "2.2" ,
525
362
) ;
526
363
527
364
assert . deepStrictEqual ( result , targetV2_2 ) ;
@@ -566,7 +403,7 @@ describe("readTarget", () => {
566
403
] ) ;
567
404
const result = await readTarget (
568
405
path . join ( tmpPath , "target-v2_5.json" ) ,
569
- TargetV2_5 ,
406
+ "2.5" ,
570
407
) ;
571
408
572
409
assert . deepStrictEqual ( result , targetV2_5 ) ;
@@ -618,7 +455,7 @@ describe("readTarget", () => {
618
455
] ) ;
619
456
const result = await readTarget (
620
457
path . join ( tmpPath , "target-v2_6.json" ) ,
621
- TargetV2_6 ,
458
+ "2.6" ,
622
459
) ;
623
460
624
461
assert . deepStrictEqual ( result , targetV2_6 ) ;
@@ -677,7 +514,7 @@ describe("readTarget", () => {
677
514
] ) ;
678
515
const result = await readTarget (
679
516
path . join ( tmpPath , "target-v2_7.json" ) ,
680
- TargetV2_7 ,
517
+ "2.7" ,
681
518
) ;
682
519
683
520
assert . deepStrictEqual ( result , targetV2_7 ) ;
@@ -739,7 +576,7 @@ describe("readTarget", () => {
739
576
] ) ;
740
577
const result = await readTarget (
741
578
path . join ( tmpPath , "target-v2_8.json" ) ,
742
- TargetV2_8 ,
579
+ "2.8" ,
743
580
) ;
744
581
745
582
assert . deepStrictEqual ( result , targetV2_8 ) ;
@@ -780,60 +617,14 @@ describe("readCache", () => {
780
617
const tmpPath = createMockReplyDirectory ( context , [
781
618
[ "cache-v2.json" , mockCache ] ,
782
619
] ) ;
783
- const result = await readCache ( path . join ( tmpPath , "cache-v2.json" ) ) ;
620
+ const result = await readCache ( path . join ( tmpPath , "cache-v2.json" ) , "2.0" ) ;
784
621
785
622
// Verify the entire structure matches our mock data
786
623
assert . deepStrictEqual ( result , mockCache ) ;
787
624
} ) ;
788
625
} ) ;
789
626
790
627
describe ( "readCmakeFiles" , ( ) => {
791
- it ( "reads a well-formed cmakeFiles file" , async function ( context ) {
792
- const mockCmakeFiles = {
793
- kind : "cmakeFiles" ,
794
- version : { major : 1 , minor : 1 } ,
795
- paths : {
796
- build : "/path/to/top-level-build-dir" ,
797
- source : "/path/to/top-level-source-dir" ,
798
- } ,
799
- inputs : [
800
- {
801
- path : "CMakeLists.txt" ,
802
- } ,
803
- {
804
- isGenerated : true ,
805
- path : "/path/to/top-level-build-dir/.../CMakeSystem.cmake" ,
806
- } ,
807
- {
808
- isExternal : true ,
809
- path : "/path/to/external/third-party/module.cmake" ,
810
- } ,
811
- {
812
- isCMake : true ,
813
- isExternal : true ,
814
- path : "/path/to/cmake/Modules/CMakeGenericSystem.cmake" ,
815
- } ,
816
- ] ,
817
- globsDependent : [
818
- {
819
- expression : "src/*.cxx" ,
820
- recurse : true ,
821
- paths : [ "src/foo.cxx" , "src/bar.cxx" ] ,
822
- } ,
823
- ] ,
824
- } ;
825
-
826
- const tmpPath = createMockReplyDirectory ( context , [
827
- [ "cmakeFiles-v1.json" , mockCmakeFiles ] ,
828
- ] ) ;
829
- const result = await readCmakeFiles (
830
- path . join ( tmpPath , "cmakeFiles-v1.json" ) ,
831
- ) ;
832
-
833
- // Verify the entire structure matches our mock data
834
- assert . deepStrictEqual ( result , mockCmakeFiles ) ;
835
- } ) ;
836
-
837
628
// Base objects for reusable test data
838
629
const baseCmakeFiles = {
839
630
kind : "cmakeFiles" as const ,
@@ -863,7 +654,7 @@ describe("readCmakeFiles", () => {
863
654
] ) ;
864
655
const result = await readCmakeFiles (
865
656
path . join ( tmpPath , "cmakeFiles-v1_0.json" ) ,
866
- CmakeFilesV1_0 ,
657
+ "1.0" ,
867
658
) ;
868
659
869
660
assert . deepStrictEqual ( result , cmakeFilesV1_0 ) ;
@@ -887,7 +678,7 @@ describe("readCmakeFiles", () => {
887
678
] ) ;
888
679
const result = await readCmakeFiles (
889
680
path . join ( tmpPath , "cmakeFiles-v1_1.json" ) ,
890
- CmakeFilesV1_1 ,
681
+ "1.1" ,
891
682
) ;
892
683
893
684
assert . deepStrictEqual ( result , cmakeFilesV1_1 ) ;
@@ -980,6 +771,7 @@ describe("readToolchains", () => {
980
771
] ) ;
981
772
const result = await readToolchains (
982
773
path . join ( tmpPath , "toolchains-v1.json" ) ,
774
+ "1.0" ,
983
775
) ;
984
776
985
777
// Verify the entire structure matches our mock data
@@ -1007,6 +799,7 @@ describe("readConfigureLog", () => {
1007
799
] ) ;
1008
800
const result = await readConfigureLog (
1009
801
path . join ( tmpPath , "configureLog-v1.json" ) ,
802
+ "1.0" ,
1010
803
) ;
1011
804
assert . deepStrictEqual ( result , mockConfigureLog ) ;
1012
805
} ) ;
0 commit comments