test_capture: allow both Unix and Windows line sep

On Linux/macOS we allow \n in the end of the line.
On Windows we allow both \r\n and \n. Here we also allow Unix line
seperators as tests might be excuted in for example git-shell.

Change-Id: I3975b563cf95407da92e5479980e670eb748b30e
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/353181
Tested-by: Daniel Kutik <daniel.kutik@lavawerk.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Daniel Kutik 2022-11-27 13:42:50 +01:00
parent 3593a10643
commit e287fa760b

View File

@ -159,7 +159,9 @@ class RunCommand(RepoWrapperTestCase):
def test_capture(self): def test_capture(self):
"""Check capture_output handling.""" """Check capture_output handling."""
ret = self.wrapper.run_command(['echo', 'hi'], capture_output=True) ret = self.wrapper.run_command(['echo', 'hi'], capture_output=True)
self.assertEqual(ret.stdout, 'hi\n') # echo command appends OS specific linesep, but on Windows + Git Bash
# we get UNIX ending, so we allow both.
self.assertIn(ret.stdout, ['hi' + os.linesep, 'hi\n'])
def test_check(self): def test_check(self):
"""Check check handling.""" """Check check handling."""