1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-23 14:41:43 +00:00

xattr: test split_lstring

This commit is contained in:
Marian Beermann 2017-06-27 12:21:30 +02:00
parent 78f0e5d473
commit 6c67b64ab6

View file

@ -2,7 +2,9 @@
import tempfile
import unittest
from ..xattr import is_enabled, getxattr, setxattr, listxattr, buffer
import pytest
from ..xattr import is_enabled, getxattr, setxattr, listxattr, buffer, split_lstring
from . import BaseTestCase
@ -58,3 +60,13 @@ def test_getxattr_buffer_growth(self):
got_value = getxattr(self.tmpfile.name, 'user.big')
self.assert_equal(value, got_value)
self.assert_equal(len(buffer), 128)
@pytest.mark.parametrize('lstring, splitted', (
(b'', []),
(b'\x00', [b'']),
(b'\x01a', [b'a']),
(b'\x01a\x02cd', [b'a', b'cd']),
))
def test_split_lstring(lstring, splitted):
assert split_lstring(lstring) == splitted