Commit 2abe42f9 authored by Hitoshi Yoshida's avatar Hitoshi Yoshida Committed by Commit Bot

CodeGen: Display multiple lines better in test failure

In comparing ASCII-only strings, unittest module displays
multiple lines strings in one line using new line characters ("\n")

  "abc\nxyz" != "abo\nxyz"

With this change, it shows the lines which differs and its around.

  "abc\nxyz" != "abo\nxyz"
  - abc
  ?   ^
  + abo
  ?   ^
  xyz


Bug: 839389
Change-Id: Icd8fc5001f02d1b6d7c6abb277836d842b1f424f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1909767Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714165}
parent e4f3a088
......@@ -17,6 +17,10 @@ from .mako_renderer import MakoRenderer
class CodeNodeTest(unittest.TestCase):
def setUp(self):
super(CodeNodeTest, self).setUp()
self.addTypeEqualityFunc(str, self.assertMultiLineEqual)
def assertRenderResult(self, node, expected):
if node.renderer is None:
node.set_renderer(MakoRenderer())
......
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