Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
ee5e3043
Commit
ee5e3043
authored
Mar 08, 2022
by
Szymon Sobik
Browse files
Add support for testing of xml and json output of source file and line location
parent
f7621f01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
googletest/test/gtest_json_test_utils.py
googletest/test/gtest_json_test_utils.py
+2
-0
googletest/test/gtest_xml_test_utils.py
googletest/test/gtest_xml_test_utils.py
+4
-0
No files found.
googletest/test/gtest_json_test_utils.py
View file @
ee5e3043
...
@@ -50,6 +50,8 @@ def normalize(obj):
...
@@ -50,6 +50,8 @@ def normalize(obj):
elif
key
==
'failure'
:
elif
key
==
'failure'
:
value
=
re
.
sub
(
r
'^.*[/\\](.*:)\d+\n'
,
'
\\
1*
\n
'
,
value
)
value
=
re
.
sub
(
r
'^.*[/\\](.*:)\d+\n'
,
'
\\
1*
\n
'
,
value
)
return
re
.
sub
(
r
'Stack trace:\n(.|\n)*'
,
'Stack trace:
\n
*'
,
value
)
return
re
.
sub
(
r
'Stack trace:\n(.|\n)*'
,
'Stack trace:
\n
*'
,
value
)
elif
key
==
'file'
:
return
re
.
sub
(
r
'^.*[/\\](.*)'
,
'
\\
1'
,
value
)
else
:
else
:
return
normalize
(
value
)
return
normalize
(
value
)
if
isinstance
(
obj
,
dict
):
if
isinstance
(
obj
,
dict
):
...
...
googletest/test/gtest_xml_test_utils.py
View file @
ee5e3043
...
@@ -170,6 +170,10 @@ class GTestXMLTestCase(gtest_test_utils.TestCase):
...
@@ -170,6 +170,10 @@ class GTestXMLTestCase(gtest_test_utils.TestCase):
* The stack traces are removed.
* The stack traces are removed.
"""
"""
if
element
.
tagName
==
'testcase'
:
source_file
=
element
.
getAttributeNode
(
'file'
)
if
source_file
:
source_file
.
value
=
re
.
sub
(
r
'^.*[/\\](.*)'
,
'
\\
1'
,
source_file
.
value
)
if
element
.
tagName
in
(
'testsuites'
,
'testsuite'
,
'testcase'
):
if
element
.
tagName
in
(
'testsuites'
,
'testsuite'
,
'testcase'
):
timestamp
=
element
.
getAttributeNode
(
'timestamp'
)
timestamp
=
element
.
getAttributeNode
(
'timestamp'
)
timestamp
.
value
=
re
.
sub
(
r
'^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\d$'
,
timestamp
.
value
=
re
.
sub
(
r
'^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\d$'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment