mirror of
https://github.com/facebook/zstd.git
synced 2025-07-30 22:23:13 +03:00
Simplify line splitting in the CLI tests
This commit is contained in:
committed by
Nick Terrell
parent
29b8a3d8f2
commit
3b001a38fe
@ -114,20 +114,12 @@ def pop_line(data: bytes) -> typing.Tuple[typing.Optional[bytes], bytes]:
|
|||||||
if data == b'':
|
if data == b'':
|
||||||
return (None, data)
|
return (None, data)
|
||||||
|
|
||||||
newline_idx = data.find(b"\n")
|
parts = data.split(NEWLINE, maxsplit=1)
|
||||||
if newline_idx == -1:
|
line = parts[0] + NEWLINE
|
||||||
end_idx = len(data)
|
if len(parts) == 1:
|
||||||
else:
|
return line, b''
|
||||||
end_idx = newline_idx + 1
|
|
||||||
|
|
||||||
line = data[:end_idx]
|
return line, parts[1]
|
||||||
data = data[end_idx:]
|
|
||||||
|
|
||||||
assert len(line) != 0
|
|
||||||
if not line.endswith(NEWLINE):
|
|
||||||
line += NEWLINE
|
|
||||||
|
|
||||||
return (line, data)
|
|
||||||
|
|
||||||
|
|
||||||
def glob_line_matches(actual: bytes, expect: bytes) -> bool:
|
def glob_line_matches(actual: bytes, expect: bytes) -> bool:
|
||||||
|
Reference in New Issue
Block a user