Skip to content

Commit 312f19a

Browse files
committed
Add in a test for a Vietnamese filename.
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
1 parent a1ab5f2 commit 312f19a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/integration/test_parse.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3218,6 +3218,36 @@ def test_parse_walk_shiftjis(tmpdir):
32183218
assert(expected_filenames == seen_filenames)
32193219
iso.close()
32203220

3221+
def test_parse_walk_vietnamese(tmpdir):
3222+
# The filename below is UTF8 encoded, and in Vietnamese is: Yêu cầu ưu đãi
3223+
# (according to Google translate, 'request offer')
3224+
# 20 bytes
3225+
vietnamese_filename = b'\x59\xc3\xaa\x75\x20\x63\xe1\xba\xa7\x75\x20\xc6\xb0\x75\x20\xc4\x91\xc3\xa3\x69'
3226+
3227+
indir = tmpdir.mkdir('vietnamese')
3228+
outfile = str(indir)+'.iso'
3229+
with open(os.path.join(str(indir), 'foodfoodfoodfood.foo'), 'wb') as outfp:
3230+
outfp.write(b'foo\n')
3231+
subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '3', '-no-pad',
3232+
'-o', str(outfile), str(indir)])
3233+
3234+
with open(str(outfile), 'r+b') as fp:
3235+
fp.seek(23*2048 + 101)
3236+
fp.write(vietnamese_filename)
3237+
3238+
iso = pycdlib.PyCdlib()
3239+
iso.open(str(outfile))
3240+
3241+
expected_filenames = [vietnamese_filename.decode('utf8') + ';1']
3242+
3243+
# Ensure that we don't see duplicates of any directory names
3244+
seen_filenames = []
3245+
for dirname, dirlist, filelist in iso.walk(iso_path='/'):
3246+
seen_filenames.extend(filelist)
3247+
3248+
assert(expected_filenames == seen_filenames)
3249+
iso.close()
3250+
32213251
def test_parse_one_extent_path_tables(tmpdir):
32223252
indir = tmpdir.mkdir('onefileonextentpathtables')
32233253
outfile = str(indir)+'.iso'

0 commit comments

Comments
 (0)