mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2026-06-19 22:28:17 +02:00
Merge pull request #697 from fuleinist/fix/lsattr-filename-spaces
Fix lsattr parser for filenames with spaces
This commit is contained in:
@@ -0,0 +1 @@
|
||||
[{"file": "./ok ok ok ok ok", "extents": true}]
|
||||
@@ -0,0 +1 @@
|
||||
--------------e----- ./ok ok ok ok ok
|
||||
+14
-1
@@ -18,6 +18,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-20.04/lsattr.out'), 'r', encoding='utf-8') as f:
|
||||
ubuntu_20_4_lsattr = f.read()
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-20.04/lsattr-spaces.out'), 'r', encoding='utf-8') as f:
|
||||
ubuntu_20_4_lsattr_spaces = f.read()
|
||||
|
||||
# output
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-20.04/lsattr-error.json'), 'r', encoding='utf-8') as f:
|
||||
ubuntu_20_4_lsattr_error_json = json.loads(f.read())
|
||||
@@ -28,6 +31,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-20.04/lsattr.json'), 'r', encoding='utf-8') as f:
|
||||
ubuntu_20_4_lsattr_json = json.loads(f.read())
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-20.04/lsattr-spaces.json'), 'r', encoding='utf-8') as f:
|
||||
ubuntu_20_4_lsattr_spaces_json = json.loads(f.read())
|
||||
|
||||
def test_lsattr_nodata(self):
|
||||
"""
|
||||
Test 'lsattr' with no data
|
||||
@@ -52,5 +58,12 @@ class MyTests(unittest.TestCase):
|
||||
"""
|
||||
self.assertEqual(jc.parsers.lsattr.parse(self.ubuntu_20_4_lsattr, quiet=True), self.ubuntu_20_4_lsattr_json)
|
||||
|
||||
def test_lsattr_spaces(self):
|
||||
"""
|
||||
Test 'lsattr' with filenames containing spaces
|
||||
"""
|
||||
self.assertEqual(jc.parsers.lsattr.parse(self.ubuntu_20_4_lsattr_spaces, quiet=True), self.ubuntu_20_4_lsattr_spaces_json)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user