@@ -10,83 +10,82 @@ import { activate } from '../utils';
10
10
import { adaExtState } from '../../../src/extension' ;
11
11
12
12
suite ( 'Debug Configurations' , function ( ) {
13
- let expectedConfigs : string ;
13
+ let expectedConfigs : AdaConfig [ ] ;
14
14
15
15
this . beforeAll ( async ( ) => {
16
16
await activate ( ) ;
17
- expectedConfigs = `
18
- [
19
- {
20
- "type": "cppdbg",
21
- "name": "Ada: Debug main - src/main1.adb",
22
- "request": "launch",
23
- "targetArchitecture": "x64",
24
- "cwd": "\${workspaceFolder}",
25
- "program": "\${workspaceFolder}/obj/main1exec${ exe } ",
26
- "stopAtEntry": false,
27
- "externalConsole": false,
28
- "args": [],
29
- "MIMode": "gdb",
30
- "preLaunchTask": "ada: Build main - src/main1.adb",
31
- "setupCommands": [
32
- {
33
- "description": "Catch all Ada exceptions",
34
- "text": "catch exception",
35
- "ignoreFailures": true
36
- },
37
- {
38
- "description": "Enable pretty-printing for gdb",
39
- "text": "-enable-pretty-printing",
40
- "ignoreFailures": true
41
- }
42
- ],
43
- "miDebuggerPath": "${ getOrFindGdb ( ) ?. replace ( / \\ / g, '\\\\' ) ?? '<undefined>' } "
44
- },
45
- {
46
- "name": "Ada: Attach debugger to running process - src/main1.adb",
47
- "type": "cppdbg",
48
- "request": "attach",
49
- "program": "\${workspaceFolder}/obj/main1exec${ exe } ",
50
- "processId": "\${command:pickProcess}",
51
- "MIMode": "gdb",
52
- "miDebuggerPath": "${ getOrFindGdb ( ) ?. replace ( / \\ / g, '\\\\' ) ?? '<undefined>' } "
53
- },
54
- {
55
- "type": "cppdbg",
56
- "name": "Ada: Debug main - src/test.adb",
57
- "request": "launch",
58
- "targetArchitecture": "x64",
59
- "cwd": "\${workspaceFolder}",
60
- "program": "\${workspaceFolder}/obj/test${ exe } ",
61
- "stopAtEntry": false,
62
- "externalConsole": false,
63
- "args": [],
64
- "MIMode": "gdb",
65
- "preLaunchTask": "ada: Build main - src/test.adb",
66
- "setupCommands": [
67
- {
68
- "description": "Catch all Ada exceptions",
69
- "text": "catch exception",
70
- "ignoreFailures": true
71
- },
72
- {
73
- "description": "Enable pretty-printing for gdb",
74
- "text": "-enable-pretty-printing",
75
- "ignoreFailures": true
76
- }
77
- ],
78
- "miDebuggerPath": "${ getOrFindGdb ( ) ?? '<undefined>' } "
79
- },
80
- {
81
- "name": "Ada: Attach debugger to running process - src/test.adb",
82
- "type": "cppdbg",
83
- "request": "attach",
84
- "program": "\${workspaceFolder}/obj/test${ exe } ",
85
- "processId": "\${command:pickProcess}",
86
- "MIMode": "gdb",
87
- "miDebuggerPath": "${ getOrFindGdb ( ) ?? '<undefined>' } "
88
- }
89
- ]` ;
17
+ expectedConfigs = [
18
+ {
19
+ type : 'cppdbg' ,
20
+ name : 'Ada: Debug main - src/main1.adb' ,
21
+ request : 'launch' ,
22
+ targetArchitecture : 'x64' ,
23
+ cwd : '${workspaceFolder}' ,
24
+ program : '${workspaceFolder}/obj/main1exec' + exe ,
25
+ stopAtEntry : false ,
26
+ externalConsole : false ,
27
+ args : [ ] ,
28
+ MIMode : 'gdb' ,
29
+ preLaunchTask : 'ada: Build main - src/main1.adb' ,
30
+ setupCommands : [
31
+ {
32
+ description : 'Catch all Ada exceptions' ,
33
+ text : 'catch exception' ,
34
+ ignoreFailures : true ,
35
+ } ,
36
+ {
37
+ description : 'Enable pretty-printing for gdb' ,
38
+ text : '-enable-pretty-printing' ,
39
+ ignoreFailures : true ,
40
+ } ,
41
+ ] ,
42
+ miDebuggerPath : getOrFindGdb ( ) ?? '<undefined>' ,
43
+ } ,
44
+ {
45
+ name : 'Ada: Attach debugger to running process - src/main1.adb' ,
46
+ type : 'cppdbg' ,
47
+ request : 'attach' ,
48
+ program : '${workspaceFolder}/obj/main1exec' + exe ,
49
+ processId : '${command:pickProcess}' ,
50
+ MIMode : 'gdb' ,
51
+ miDebuggerPath : getOrFindGdb ( ) ?? '<undefined>' ,
52
+ } ,
53
+ {
54
+ type : 'cppdbg' ,
55
+ name : 'Ada: Debug main - src/test.adb' ,
56
+ request : 'launch' ,
57
+ targetArchitecture : 'x64' ,
58
+ cwd : '${workspaceFolder}' ,
59
+ program : '${workspaceFolder}/obj/test' + exe ,
60
+ stopAtEntry : false ,
61
+ externalConsole : false ,
62
+ args : [ ] ,
63
+ MIMode : 'gdb' ,
64
+ preLaunchTask : 'ada: Build main - src/test.adb' ,
65
+ setupCommands : [
66
+ {
67
+ description : 'Catch all Ada exceptions' ,
68
+ text : 'catch exception' ,
69
+ ignoreFailures : true ,
70
+ } ,
71
+ {
72
+ description : 'Enable pretty-printing for gdb' ,
73
+ text : '-enable-pretty-printing' ,
74
+ ignoreFailures : true ,
75
+ } ,
76
+ ] ,
77
+ miDebuggerPath : getOrFindGdb ( ) ?? '<undefined>' ,
78
+ } ,
79
+ {
80
+ name : 'Ada: Attach debugger to running process - src/test.adb' ,
81
+ type : 'cppdbg' ,
82
+ request : 'attach' ,
83
+ program : '${workspaceFolder}/obj/test' + exe ,
84
+ processId : '${command:pickProcess}' ,
85
+ MIMode : 'gdb' ,
86
+ miDebuggerPath : getOrFindGdb ( ) ?? '<undefined>' ,
87
+ } ,
88
+ ] ;
90
89
} ) ;
91
90
92
91
test ( 'GDB path is explicitely set in offered debug config' , async ( ) => {
@@ -136,24 +135,18 @@ All of the above - Create all of the above configurations in the launch.json fil
136
135
expected . trim ( )
137
136
) ;
138
137
139
- assert . equal (
140
- JSON . stringify (
141
- quickpick
142
- . filter ( ( e ) => 'conf' in e )
143
- . map ( ( e ) => {
144
- assert ( 'conf' in e ) ;
145
- return e . conf ;
146
- } ) ,
147
- null ,
148
- 2
149
- ) . trim ( ) ,
150
- expectedConfigs . trim ( )
151
- ) ;
138
+ const actualConfigs = quickpick
139
+ . filter ( ( e ) => 'conf' in e )
140
+ . map ( ( e ) => {
141
+ assert ( 'conf' in e ) ;
142
+ return e . conf ;
143
+ } ) ;
144
+
145
+ assert . deepEqual ( actualConfigs , expectedConfigs ) ;
152
146
} ) ;
153
147
154
148
test ( 'Dynamic' , async ( ) => {
155
149
const configs = await adaExtState . dynamicDebugConfigProvider . provideDebugConfigurations ( ) ;
156
-
157
- assert . equal ( JSON . stringify ( configs , undefined , 2 ) . trim ( ) , expectedConfigs . trim ( ) ) ;
150
+ assert . deepEqual ( configs , expectedConfigs ) ;
158
151
} ) ;
159
152
} ) ;
0 commit comments