File tree Expand file tree Collapse file tree 6 files changed +146
-69
lines changed Expand file tree Collapse file tree 6 files changed +146
-69
lines changed Original file line number Diff line number Diff line change 1
1
-- ----------------------------------------------------------------------------
2
2
-- Language Server Protocol --
3
3
-- --
4
- -- Copyright (C) 2018-2019 , AdaCore --
4
+ -- Copyright (C) 2018-2023 , AdaCore --
5
5
-- --
6
6
-- This is free software; you can redistribute it and/or modify it under --
7
7
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -22,6 +22,9 @@ with Ada.Strings.Maps;
22
22
23
23
with GNAT.Regpat ;
24
24
with GNAT.OS_Lib ;
25
+
26
+ with VSS.Strings.Conversions ;
27
+
25
28
with URIs ;
26
29
27
30
package body Tester.Macros is
@@ -171,11 +174,16 @@ package body Tester.Macros is
171
174
procedure Expand
172
175
(Test : in out GNATCOLL.JSON.JSON_Value;
173
176
Env : Spawn.Environments.Process_Environment;
174
- Path : String )
177
+ Path : VSS.Strings.Virtual_String )
175
178
is
176
- Full_Name : constant String := Ada.Directories.Full_Name (Path);
179
+ File : constant String :=
180
+ VSS.Strings.Conversions.To_UTF_8_String (Path);
181
+
182
+ Full_Name : constant String := Ada.Directories.Full_Name (File);
183
+
177
184
Directory : constant String :=
178
185
Ada.Directories.Containing_Directory (Full_Name);
186
+
179
187
Env_With_Dir : Spawn.Environments.Process_Environment := Env;
180
188
begin
181
189
Env_With_Dir.Insert (" DIR" , Directory);
Original file line number Diff line number Diff line change 1
1
-- ----------------------------------------------------------------------------
2
2
-- Language Server Protocol --
3
3
-- --
4
- -- Copyright (C) 2018-2019 , AdaCore --
4
+ -- Copyright (C) 2018-2023 , AdaCore --
5
5
-- --
6
6
-- This is free software; you can redistribute it and/or modify it under --
7
7
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -19,15 +19,17 @@ with GNATCOLL.JSON;
19
19
20
20
with Spawn.Environments ;
21
21
22
+ with VSS.Strings ;
23
+
22
24
package Tester.Macros is
23
25
24
26
procedure Expand
25
27
(Test : in out GNATCOLL.JSON.JSON_Value;
26
28
Env : Spawn.Environments.Process_Environment;
27
- Path : String );
29
+ Path : VSS.Strings.Virtual_String );
28
30
-- Expand macros in given JSON test. The Path is test's path.
29
31
--
30
- -- Currently only one macro is supported:
32
+ -- Currently next macros are supported:
31
33
-- * ${NAME} - expands with environment variable NAME from Env
32
34
--
33
35
-- * $URI{x} - rewrite as "file:///path", treat x as relative to test
Original file line number Diff line number Diff line change @@ -26,9 +26,6 @@ with VSS.Strings;
26
26
with VSS.Strings.Conversions ;
27
27
with VSS.String_Vectors ;
28
28
29
- with Spawn.Environments ;
30
-
31
- with Tester.Macros ;
32
29
with Tester.Tests ;
33
30
34
31
procedure Tester.Run is
@@ -52,9 +49,6 @@ procedure Tester.Run is
52
49
Description => " JSON test script" );
53
50
end Options ;
54
51
55
- Env : constant Spawn.Environments.Process_Environment :=
56
- Spawn.Environments.System_Environment;
57
-
58
52
JSON : GNATCOLL.JSON.JSON_Value;
59
53
begin
60
54
VSS.Command_Line.Add_Option (Options.Debug);
@@ -105,15 +99,15 @@ begin
105
99
106
100
Ada.Text_IO.Close (Input);
107
101
JSON := GNATCOLL.JSON.Read (Text, File);
108
- Tester.Macros.Expand (JSON, Env, File);
109
102
110
103
declare
111
104
Test : Tester.Tests.Test;
112
105
begin
113
106
Test.Run
114
- (JSON.Get,
115
- On_Hang => Options.On_Hang.Value,
116
- Debug => Options.Debug.Is_Specified);
107
+ (Commands => JSON.Get,
108
+ File => Options.File.Value,
109
+ On_Hang => Options.On_Hang.Value,
110
+ Debug => Options.Debug.Is_Specified);
117
111
end ;
118
112
end ;
119
113
end Tester.Run ;
You can’t perform that action at this time.
0 commit comments