Skip to content

Commit bae2e1e

Browse files
author
automatic-merge
committed
Merge remote branch 'origin/master' into edge
2 parents 901f228 + 4563e54 commit bae2e1e

File tree

5 files changed

+54
-12
lines changed

5 files changed

+54
-12
lines changed

integration/vscode/ada/.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ tsconfig.json
1616
**/*.ts.map
1717
xfail.yaml
1818
vscode-test-win-workaround.py
19+
convert-mocha-junit-report.py
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#! env python
2+
"""This tool wraps around the e3.testsuite XUnit report import feature to customize test
3+
naming based on the reports obtained in VS Code testing from the mocha-junit-reporter
4+
module."""
5+
6+
from e3.testsuite.report.xunit import XUnitImporter, XUnitImporterApp
7+
8+
9+
class XUnitImporterCustomTestNaming(XUnitImporter):
10+
def get_test_name(
11+
self,
12+
testsuite_name: str,
13+
testcase_name: str,
14+
classname: str | None = None,
15+
) -> str:
16+
"""Override naming scheme to ignore the testcase name because it
17+
duplicates the information from the testsuite name and the classname
18+
attribute."""
19+
return super().get_test_name(testsuite_name, "", classname)
20+
21+
22+
class MochaJUnitImporterApp(XUnitImporterApp):
23+
24+
def create_importer(self) -> XUnitImporter:
25+
return XUnitImporterCustomTestNaming(self.index, self.xfails)
26+
27+
28+
if __name__ == "__main__":
29+
MochaJUnitImporterApp().run()

source/ada/lsp-ada_contexts.ads

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,11 @@ package LSP.Ada_Contexts is
248248
Stop : in out Boolean);
249249
Unit_Prefix : VSS.Strings.Virtual_String :=
250250
VSS.Strings.Empty_Virtual_String);
251-
-- Find symbols starting with given Prefix in all files of the context and
252-
-- call Callback for each. Name could contain a stale reference if the File
251+
-- Find symbols that match the given Pattern in all files of the context and
252+
-- call Callback for each.
253+
-- If Pattern is an empty string, all the symbols in all files will be
254+
-- returned.
255+
-- Name could contain a stale reference if the File
253256
-- was updated since last indexing operation. If Only_Public is True it
254257
-- will skip any "private" symbols (like symbols in private part or body).
255258
-- Unit_Prefix is used for additional filtering: when specified, only the

source/ada/lsp-ada_file_sets.adb

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,14 @@ package body LSP.Ada_File_Sets is
146146
-- Match each element individually because
147147
-- All_Symbols is case insensitive
148148
for Item of Self.All_Symbols (Cursor) loop
149-
Defining_Name := Get_Defining_Name (Item.File, Item.Loc);
150-
151-
if not Defining_Name.Is_Null
152-
and then Pattern.Match
153-
(VSS.Strings.To_Virtual_String
154-
(Defining_Name.As_Ada_Node.Text))
149+
Defining_Name :=
150+
Get_Defining_Name (Item.File, Item.Loc);
151+
152+
if not Defining_Name.Is_Null and then
153+
(Pattern.Get_Canonical_Pattern.Is_Empty
154+
or else Pattern.Match
155+
(VSS.Strings.To_Virtual_String
156+
(Defining_Name.As_Ada_Node.Text)))
155157
then
156158
if not Only_Public or else Item.Is_Public then
157159
Callback (Item.File, Defining_Name, Stop);
@@ -161,12 +163,16 @@ package body LSP.Ada_File_Sets is
161163
end if;
162164
end loop;
163165

164-
elsif Pattern.Match (Symbol_Maps.Key (Cursor)) then
166+
elsif
167+
Pattern.Get_Canonical_Pattern.Is_Empty
168+
or else Pattern.Match (Symbol_Maps.Key (Cursor))
169+
then
165170
-- All_Symbols is case insensitive so if the key is matched
166171
-- this means that all elements are also matched the pattern
167172
for Item of Self.All_Symbols (Cursor) loop
168173
if not Only_Public or else Item.Is_Public then
169-
Defining_Name := Get_Defining_Name (Item.File, Item.Loc);
174+
Defining_Name :=
175+
Get_Defining_Name (Item.File, Item.Loc);
170176
if not Defining_Name.Is_Null
171177
and then Matches_Unit_Prefix (Defining_Name)
172178
then

source/ada/lsp-ada_file_sets.ads

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,11 @@ package LSP.Ada_File_Sets is
8888
Stop : in out Boolean);
8989
Unit_Prefix : VSS.Strings.Virtual_String :=
9090
VSS.Strings.Empty_Virtual_String);
91-
-- Find symbols starting with given Prefix in all files of the set and
92-
-- call Callback for each. Get_Defining_Name callback is used for getting
91+
-- Find symbols that match the given Pattern in all files of the set and
92+
-- call Callback for each.
93+
-- If Pattern is an empty string, all the symbols in all files will be
94+
-- returned.
95+
-- Get_Defining_Name callback is used for getting
9396
-- the Defining_Name at the given location Loc in a unit.
9497
-- Name could contain a stale reference if the File was updated since
9598
-- last indexing operation. If Only_Public is True it will skip any

0 commit comments

Comments
 (0)