Skip to content

Commit

Permalink
Merge remote branch 'origin/master' into edge
Browse files Browse the repository at this point in the history
  • Loading branch information
automatic-merge committed Jul 22, 2024
2 parents 901f228 + 4563e54 commit bae2e1e
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 12 deletions.
1 change: 1 addition & 0 deletions integration/vscode/ada/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ tsconfig.json
**/*.ts.map
xfail.yaml
vscode-test-win-workaround.py
convert-mocha-junit-report.py
29 changes: 29 additions & 0 deletions integration/vscode/ada/convert-mocha-junit-report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#! env python
"""This tool wraps around the e3.testsuite XUnit report import feature to customize test
naming based on the reports obtained in VS Code testing from the mocha-junit-reporter
module."""

from e3.testsuite.report.xunit import XUnitImporter, XUnitImporterApp


class XUnitImporterCustomTestNaming(XUnitImporter):
def get_test_name(
self,
testsuite_name: str,
testcase_name: str,
classname: str | None = None,
) -> str:
"""Override naming scheme to ignore the testcase name because it
duplicates the information from the testsuite name and the classname
attribute."""
return super().get_test_name(testsuite_name, "", classname)


class MochaJUnitImporterApp(XUnitImporterApp):

def create_importer(self) -> XUnitImporter:
return XUnitImporterCustomTestNaming(self.index, self.xfails)


if __name__ == "__main__":
MochaJUnitImporterApp().run()
7 changes: 5 additions & 2 deletions source/ada/lsp-ada_contexts.ads
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,11 @@ package LSP.Ada_Contexts is
Stop : in out Boolean);
Unit_Prefix : VSS.Strings.Virtual_String :=
VSS.Strings.Empty_Virtual_String);
-- Find symbols starting with given Prefix in all files of the context and
-- call Callback for each. Name could contain a stale reference if the File
-- Find symbols that match the given Pattern in all files of the context and
-- call Callback for each.
-- If Pattern is an empty string, all the symbols in all files will be
-- returned.
-- Name could contain a stale reference if the File
-- was updated since last indexing operation. If Only_Public is True it
-- will skip any "private" symbols (like symbols in private part or body).
-- Unit_Prefix is used for additional filtering: when specified, only the
Expand Down
22 changes: 14 additions & 8 deletions source/ada/lsp-ada_file_sets.adb
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,14 @@ package body LSP.Ada_File_Sets is
-- Match each element individually because
-- All_Symbols is case insensitive
for Item of Self.All_Symbols (Cursor) loop
Defining_Name := Get_Defining_Name (Item.File, Item.Loc);

if not Defining_Name.Is_Null
and then Pattern.Match
(VSS.Strings.To_Virtual_String
(Defining_Name.As_Ada_Node.Text))
Defining_Name :=
Get_Defining_Name (Item.File, Item.Loc);

if not Defining_Name.Is_Null and then
(Pattern.Get_Canonical_Pattern.Is_Empty
or else Pattern.Match
(VSS.Strings.To_Virtual_String
(Defining_Name.As_Ada_Node.Text)))
then
if not Only_Public or else Item.Is_Public then
Callback (Item.File, Defining_Name, Stop);
Expand All @@ -161,12 +163,16 @@ package body LSP.Ada_File_Sets is
end if;
end loop;

elsif Pattern.Match (Symbol_Maps.Key (Cursor)) then
elsif
Pattern.Get_Canonical_Pattern.Is_Empty
or else Pattern.Match (Symbol_Maps.Key (Cursor))
then
-- All_Symbols is case insensitive so if the key is matched
-- this means that all elements are also matched the pattern
for Item of Self.All_Symbols (Cursor) loop
if not Only_Public or else Item.Is_Public then
Defining_Name := Get_Defining_Name (Item.File, Item.Loc);
Defining_Name :=
Get_Defining_Name (Item.File, Item.Loc);
if not Defining_Name.Is_Null
and then Matches_Unit_Prefix (Defining_Name)
then
Expand Down
7 changes: 5 additions & 2 deletions source/ada/lsp-ada_file_sets.ads
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ package LSP.Ada_File_Sets is
Stop : in out Boolean);
Unit_Prefix : VSS.Strings.Virtual_String :=
VSS.Strings.Empty_Virtual_String);
-- Find symbols starting with given Prefix in all files of the set and
-- call Callback for each. Get_Defining_Name callback is used for getting
-- Find symbols that match the given Pattern in all files of the set and
-- call Callback for each.
-- If Pattern is an empty string, all the symbols in all files will be
-- returned.
-- Get_Defining_Name callback is used for getting
-- the Defining_Name at the given location Loc in a unit.
-- Name could contain a stale reference if the File was updated since
-- last indexing operation. If Only_Public is True it will skip any
Expand Down

0 comments on commit bae2e1e

Please sign in to comment.