mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[benchmark] ReportFormatter: better inline headers
Improve inline headers in `single_table` mode to also print labels for the numeric columns. Sections in the `single_table` are visually distinguished by a separator row preceding the the inline headers. Separated header label styles for git and markdown modes with UPPERCASE and **Bold** formatting respectively. Inlined section template definitions.
This commit is contained in:
@@ -857,15 +857,33 @@ class TestReportFormatter(OldAndNewLog):
|
||||
|
||||
def test_single_table_report(self):
|
||||
"""Single table report has bold inline headers and no sections."""
|
||||
self.tc.removed = [] # test handling empty section
|
||||
rf = ReportFormatter(self.tc, changes_only=True, single_table=True)
|
||||
markdown = rf.markdown()
|
||||
self.assertNotIn('<details', markdown)
|
||||
self.assertNotIn('<details', markdown) # no sections
|
||||
self.assertNotIn('\n\n', markdown) # table must not be broken
|
||||
self.assertNotIn('Removed', markdown)
|
||||
self.assert_report_contains([
|
||||
'**Regression**', '**Added**',
|
||||
'| OLD', '| NEW', '| DELTA', '| RATIO'
|
||||
'\n**Regression** ',
|
||||
'| **OLD**', '| **NEW**', '| **DELTA**', '| **RATIO**',
|
||||
'\n**Added** ',
|
||||
'| **MIN**', '| **MAX**', '| **MEAN**', '| **MAX_RSS**'
|
||||
], markdown)
|
||||
# Single delimiter row:
|
||||
self.assertIn('\n:---', markdown) # first column is left aligned
|
||||
self.assertEqual(markdown.count('| ---:'), 4) # other, right aligned
|
||||
# Separator before every inline header (new section):
|
||||
self.assertEqual(markdown.count(' | | | | '), 2)
|
||||
|
||||
git = rf.git()
|
||||
self.assertNotIn('): \n', git) # no sections
|
||||
self.assertNotIn('REMOVED', git)
|
||||
self.assert_report_contains([
|
||||
'\nREGRESSION ', ' OLD ', ' NEW ', ' DELTA ', ' RATIO ',
|
||||
'\n\nADDED ', ' MIN ', ' MAX ', ' MEAN ', ' MAX_RSS '
|
||||
], git)
|
||||
# Separator before every inline header (new section):
|
||||
self.assertEqual(git.count('\n\n'), 2)
|
||||
|
||||
|
||||
class Test_parse_args(unittest.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user