Commit ee5e3043 authored by Szymon Sobik's avatar Szymon Sobik
Browse files

Add support for testing of xml and json output of source file and line location

parent f7621f01
...@@ -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):
......
...@@ -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$',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment