Mercurial > public > mercurial-scm > hg-stable
diff tests/test-byteify-strings.t @ 42710:26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
This improves the current fix to also take into account cases where the last
line ended on the opening `(`, `[` or `{` and adds a regression test.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Sun, 04 Aug 2019 22:14:26 +0200 |
parents | 3364b4da5271 |
children | f9b64ff9d26b |
line wrap: on
line diff
--- a/tests/test-byteify-strings.t Fri Aug 02 16:54:02 2019 +0200 +++ b/tests/test-byteify-strings.t Sun Aug 04 22:14:26 2019 +0200 @@ -215,3 +215,47 @@ $ byteify_strings testfile.py obj[b'test'] = b"1234" obj[r'test'] = u"1234" + +Test multi-line alignment + + $ cat > testfile.py <<'EOF' + > def foo(): + > error.Abort(_("foo" + > "bar" + > "%s") + > % parameter) + > { + > 'test': dict, + > 'test2': dict, + > } + > [ + > "thing", + > "thing2" + > ] + > ( + > "tuple", + > "tuple2", + > ) + > {"thing", + > } + > EOF + $ byteify_strings testfile.py + def foo(): + error.Abort(_(b"foo" + b"bar" + b"%s") + % parameter) + { + b'test': dict, + b'test2': dict, + } + [ + b"thing", + b"thing2" + ] + ( + b"tuple", + b"tuple2", + ) + {b"thing", + }