1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558
|
"""
PC-BASIC test.disk
Tests for disk devices
(c) 2020--2023 Rob Hagemans
This file is released under the GNU GPL version 3 or later.
"""
import unittest
import os
import platform
from pcbasic import Session
from pcbasic.compat import get_short_pathname
from tests.unit.utils import TestCase, run_tests
class DiskTest(TestCase):
"""Disk tests."""
tag = u'disk'
def test_text(self):
"""Save and load in plaintext to a file."""
with Session(devices={b'A': self.output_path()}, current_device='A:') as s:
s.execute('10 A%=1234')
s.execute('save "prog",A')
with Session(devices={b'A': self.output_path()}, current_device='A:') as s:
s.execute('run "prog"')
assert s.get_variable('A%') == 1234
def test_binary(self):
"""Save and load in binary format to a file."""
with Session(devices={b'A': self.output_path()}, current_device='A:') as s:
s.execute('10 A%=1234')
s.execute('save "prog"')
with Session(devices={b'A': self.output_path()}, current_device='A:') as s:
s.execute('run "prog"')
assert s.get_variable('A%') == 1234
def test_protected(self):
"""Save and load in protected format to a file."""
with Session(devices={b'A': self.output_path()}, current_device='A:') as s:
s.execute('10 A%=1234')
s.execute('save "prog", P')
with Session(devices={b'A': self.output_path()}, current_device='A:') as s:
s.execute('run "prog"')
assert s.get_variable('A%') == 1234
def test_text_letter(self):
"""Save and load in plaintext to a file, explicit drive letter."""
with Session(devices={b'A': self.output_path()}) as s:
s.execute('10 A%=1234')
s.execute('save "A:prog",A')
with Session(devices={b'A': self.output_path()}) as s:
s.execute('run "A:prog"')
assert s.get_variable('A%') == 1234
def test_files(self):
"""Test directory listing, current directory and free space report."""
with Session(devices={b'A': self.output_path()}) as s:
s.execute('save "A:prog",A')
s.execute('files "A:"')
s.execute('print "##"')
output = [_row.strip() for _row in self.get_text(s)]
assert output[:2] == [
b'A:\\',
b'. <DIR> .. <DIR> PROG .BAS'
]
assert output[2].endswith(b' Bytes free')
# empty line between files and next output
assert output[3:5] == [b'', b'##']
with Session(devices={b'A': self.output_path()}, current_device='A:') as s:
s.execute('files')
output = [_row.strip() for _row in self.get_text(s)]
assert output[:2] == [
b'A:\\',
b'. <DIR> .. <DIR> PROG .BAS'
]
def test_files_longname(self):
"""Test directory listing with long name."""
longname = self.output_path('very_long_name_and.extension')
open(longname, 'w').close()
shortname = get_short_pathname(longname) or 'very_lo+.ex+'
shortname = os.path.basename(shortname).encode('latin-1')
with Session(devices={b'A': self.output_path()}) as s:
s.execute('files "A:"')
output = [_row.strip() for _row in self.get_text(s)]
assert output[:2] == [
b'A:\\',
b'. <DIR> .. <DIR> ' + shortname
]
def test_files_wildcard(self):
"""Test directory listing with wildcards."""
open(self.output_path('aaa.txt'), 'w').close()
open(self.output_path('aab.txt'), 'w').close()
open(self.output_path('abc.txt'), 'w').close()
longname = self.output_path('aa_long_file_name.txt')
open(longname, 'w').close()
shortname = get_short_pathname(longname) or 'aa_long+.txt'
shortname = os.path.basename(shortname).encode('latin-1')
with Session(devices={b'A': self.output_path()}) as s:
s.execute('files "A:*.txt"')
output = [_row.strip() for _row in self.get_text(s)]
# output order is defined by OS, may not be alphabetic
assert b'AAA .TXT' in output[1]
assert b'AAB .TXT' in output[1]
assert b'ABC .TXT' in output[1]
assert shortname in output[1]
with Session(devices={b'A': self.output_path()}) as s:
s.execute('files "A:aa?.txt"')
output = [_row.strip() for _row in self.get_text(s)]
assert b'AAA .TXT' in output[1]
assert b'AAB .TXT' in output[1]
# no match
with Session(devices={b'A': self.output_path()}) as s:
s.execute('files "A:b*.txt"')
output = [_row.strip() for _row in self.get_text(s)]
assert output[1] == b'File not found\xff'
def test_internal_disk_files(self):
"""Test directory listing, current directory and free space report on special @: disk."""
with Session(devices={b'@': self.output_path()}) as s:
s.execute('save "@:prog",A')
s.execute('files "@:"')
output = [_row.strip() for _row in self.get_text(s)]
assert output[:2] == [
b'@:\\',
b'. <DIR> .. <DIR> PROG .BAS'
]
assert output[2].endswith(b' Bytes free')
def test_internal_disk_unbound_files(self):
"""Test directory listing, current directory and free space report on unbound @: disk."""
with Session(devices={}) as s:
s.execute('save "@:prog",A')
s.execute('files "@:"')
output = [_row.strip() for _row in self.get_text(s)]
assert output[:4] == [
b'Path not found\xff',
b'@:\\',
b'. <DIR> .. <DIR>',
b'0 Bytes free'
]
def test_disk_data(self):
"""Write and read data to a text file."""
with Session(devices={b'A': self.output_path()}) as s:
s.execute('open "a:data" for output as 1')
s.execute('print#1, 1234')
with Session(devices={b'A': self.output_path()}) as s:
s.execute('open "a:data" for input as 1')
s.execute('input#1, A%')
assert s.get_variable('A%') == 1234
def test_disk_data_utf8(self):
"""Write and read data to a text file, utf-8 encoding."""
with Session(devices={b'A': self.output_path()}, textfile_encoding='utf-8') as s:
s.execute('open "a:data" for output as 1')
# we're embedding codepage in this string, so should be bytes
s.execute(b'print#1, "\x9C"')
# utf8-sig, followed by pound sign
with open(self.output_path('DATA'), 'rb') as f:
assert f.read() == b'\xef\xbb\xbf\xc2\xa3\r\n\x1a'
with Session(devices={b'A': self.output_path()}, textfile_encoding='utf-8') as s:
s.execute('open "a:data" for append as 1')
s.execute(b'print#1, "\x9C"')
with open(self.output_path('DATA'), 'rb') as f:
assert f.read() == b'\xef\xbb\xbf\xc2\xa3\r\n\xc2\xa3\r\n\x1a'
def test_disk_data_lf(self):
"""Write and read data to a text file, soft and hard linefeed."""
with open(self.output_path('DATA'), 'wb') as f:
f.write(b'a\nb\r\nc')
with Session(devices={b'A': self.output_path()}, soft_linefeed=True) as s:
s.execute('open "a:data" for input as 1')
s.execute('line input#1, a$')
s.execute('line input#1, b$')
s.execute('line input#1, c$')
assert s.get_variable('A$') == b'a\nb'
assert s.get_variable('B$') == b'c'
assert s.get_variable('C$') == b''
with Session(devices={b'A': self.output_path()}, soft_linefeed=False) as s:
s.execute('open "a:data" for input as 1')
s.execute('line input#1, a$')
s.execute('line input#1, b$')
s.execute('line input#1, c$')
assert s.get_variable('A$') == b'a'
assert s.get_variable('B$') == b'b'
assert s.get_variable('C$') == b'c'
def test_disk_data_append(self):
"""Append data to a text file."""
with Session(devices={b'A': self.output_path()}) as s:
s.execute('open "a:data" for output as 1')
s.execute('print#1, 1234')
with Session(devices={b'A': self.output_path()}) as s:
s.execute('open "a:data" for append as 1')
s.execute('print#1, "abcde"')
with Session(devices={b'A': self.output_path()}) as s:
s.execute('open "a:data" for input as 1')
s.execute('line input#1, a$')
s.execute('line input#1, b$')
assert s.get_variable('A$') == b' 1234 '
assert s.get_variable('B$') == b'abcde'
def test_disk_random(self):
"""Write and read data to a random access file."""
with Session(devices={b'A': self.output_path()}) as s:
s.execute('open "a:data" for random as 1')
s.execute('field#1, 20 as a$, 20 as b$')
s.execute('lset b$="abcde"')
s.execute('print#1, 1234')
s.execute('put#1, 1')
with Session(devices={b'A': self.output_path()}) as s:
s.execute('open "a:data" for random as 1')
s.execute('field#1, 20 as a$, 20 as b$')
s.execute('get#1, 1')
assert s.get_variable('A$') == b' 1234 \r\n'.ljust(20, b'\0')
assert s.get_variable('B$') == b'abcde'.ljust(20, b' ')
def test_match_name(self):
"""Test case-insensitive matching of native file name."""
# this will be case sensitive on some platforms but should be picked up correctly anyway
open(self.output_path('MixCase.txt'), 'w').close()
with Session(devices={b'A': self.output_path()}) as s:
s.execute('open "a:mixcase.txt" for output as 1')
s.execute('print#1, 1234')
with Session(devices={b'A': self.output_path()}) as s:
s.execute('open "a:MIXCASE.TXT" for input as 1')
s.execute('input#1, A%')
assert s.get_variable('A%') == 1234
# check we've used the pre-existing file
with open(self.output_path('MixCase.txt'), 'rb') as f:
assert f.read() == b' 1234 \r\n\x1a'
def test_match_name_non_ascii(self):
"""Test non-matching of names that are not ascii."""
# this will be case sensitive on some platforms but should be picked up correctly anyway
open(self.output_path(u'MY\xc2\xa30.02'), 'w').close()
with Session(devices={b'A': self.output_path()}) as s:
# non-ascii not allowed - cp437 &h9c is pound sign
s.execute('open "a:MY"+chr$(&h9c)+"0.02" for output as 1')
# search for a match in the presence of non-ascii files
s.execute('open "a:MY0.02" for input as 1')
output = [_row.strip() for _row in self.get_text(s)]
assert output[:2] == [b'Bad file name\xff', b'File not found\xff']
def test_name_illegal_chars(self):
"""Test non-matching of names that are not ascii."""
with Session(devices={b'A': self.output_path()}, current_device='A:') as s:
# control chars not allowed
s.execute('open chr$(0) for output as 1')
s.execute('open chr$(1) for output as 1')
output = [_row.strip() for _row in self.get_text(s)]
# NOTE: gw raises bad file number instead
assert output[:2] == [b'Bad file name\xff', b'Bad file name\xff']
def test_name_slash(self):
"""Test non-matching of names with forward slash."""
with Session(devices={b'A': self.output_path()}, current_device='A:') as s:
# forward slash not allowed
s.execute('open "b/c" for output as 1')
output = [_row.strip() for _row in self.get_text(s)]
# NOTE: gw raises bad file number instead
assert output[0] == b'Path not found\xff'
def test_unavailable_drive(self):
"""Test attempt to access unavailable drive letter."""
with Session(devices={b'A': self.output_path()}) as s:
# drive b: not mounted
s.execute('open "b:test" for output as 1')
output = [_row.strip() for _row in self.get_text(s)]
assert output[0] == b'Path not found\xff'
def test_path(self):
"""Test accessing file through path."""
os.mkdir(self.output_path('a'))
os.mkdir(self.output_path('a', 'B'))
with Session(devices={b'A': self.output_path()}, current_device='A:') as s:
# simple relative path
s.execute('open "a\\b\\rel" for output as 1:close')
# convoluted path
s.execute('open "a\\b\\..\\..\\a\\.\\dots" for output as 1:close')
# set cwd
s.execute('chdir "a"')
# absolute path
s.execute('open "\\a\\b\\abs" for output as 1:close')
# relative path from cwd
s.execute('open ".\\this" for output as 1:close')
s.execute('open "..\\parent" for output as 1:close')
assert os.path.isfile(self.output_path('a', 'B', 'REL'))
assert os.path.isfile(self.output_path('a', 'DOTS'))
assert os.path.isfile(self.output_path('a', 'B', 'ABS'))
assert os.path.isfile(self.output_path('PARENT'))
assert os.path.isfile(self.output_path('a', 'THIS'))
def test_directory_ops(self):
"""Test directory operations."""
with Session(devices={b'A': self.output_path()}, current_device='A:') as s:
s.execute('mkdir "test"')
s.execute('mkdir "test\\test2"')
s.execute('chdir "test"')
s.execute('mkdir "remove"')
s.execute('rmdir "remove"')
assert os.path.isdir(self.output_path('TEST'))
assert os.path.isdir(self.output_path('TEST', 'TEST2'))
assert not os.path.exists(self.output_path('TEST', 'REMOVE'))
def test_file_ops(self):
"""Test file operations."""
open(self.output_path('testfile'), 'w').close()
open(self.output_path('delete.txt'), 'w').close()
open(self.output_path('delete1.txt'), 'w').close()
open(self.output_path('delete2.txt'), 'w').close()
open(self.output_path('delete3'), 'w').close()
with Session(
devices={b'A': self.output_path(), b'B': self.output_path()}, current_device='A:'
) as s:
s.execute('name "testfile" as "newname"')
# rename across disks
s.execute('name "newname" as "b:fail"')
# file already exists
s.execute('name "newname" as "delete.txt"')
s.execute('kill "delete.txt"')
s.execute('kill "delete?.txt"')
s.execute('kill "delete*"')
# file not found
s.execute('kill "notfound"')
# file not found
s.execute('kill "not*.*"')
output = [_row.strip() for _row in self.get_text(s)]
assert output[:4] == [
b'Rename across disks\xff',
b'File already exists\xff',
b'File not found\xff',
b'File not found\xff'
]
assert os.path.isfile(self.output_path('NEWNAME'))
assert not os.path.exists(self.output_path('testfile'))
assert not os.path.exists(self.output_path('delete.txt'))
assert not os.path.exists(self.output_path('delete1.txt'))
assert not os.path.exists(self.output_path('delete2.txt'))
assert not os.path.exists(self.output_path('delete3'))
def test_files_cwd(self):
"""Test directory listing, not on root."""
os.mkdir(self.output_path('a'))
with Session(devices={b'A': self.output_path()}, current_device='A:') as s:
s.execute('chdir "a"')
s.execute('files')
s.execute('files ".."')
s.execute('files "..\\"')
output = [_row.strip() for _row in self.get_text(s)]
assert output[:2] == [b'A:\\A', b'. <DIR> .. <DIR>']
assert output[4:6] == [b'A:\\A', b'. <DIR>']
assert output[8:10] == [b'A:\\A', b'. <DIR> .. <DIR> A <DIR>']
def test_files_no_disk(self):
"""Test directory listing, non-existing device."""
with Session() as s:
s.execute('files "A:"')
output = [_row.strip() for _row in self.get_text(s)]
assert output[0] == b'File not found\xff'
def test_close_not_open(self):
"""Test closing a file number that is not open."""
with Session() as s:
s.execute('close#2')
output = [_row.strip() for _row in self.get_text(s)]
# no error
assert output[0] == b''
def test_mount_dict_spec(self):
"""Test mount dict specification."""
with Session(devices={b'A': self.output_path()}) as s:
s.execute('open "A:test" for output as 1: print#1, 42: close 1')
# lowercase
with Session(devices={b'a': self.output_path()}) as s:
s.execute('open "A:test" for input as 1: input#1, A%')
assert s.get_variable('A%') == 42
# with :
with Session(devices={b'A:': self.output_path()}) as s:
s.execute('open "A:test" for input as 1: input#1, A%')
assert s.get_variable('A%') == 42
# unicode
with Session(devices={u'a:': self.output_path()}) as s:
s.execute('open "A:test" for input as 1: input#1, A%')
assert s.get_variable('A%') == 42
def test_bad_mount(self):
"""Test bad mount dict specification."""
with Session(devices={b'#': self.output_path()}) as s:
s.execute('open "A:test" for output as 1: print#1, 42: close 1')
output = [_row.strip() for _row in self.get_text(s)]
assert output[0] == b'Path not found\xff'
with Session(devices={b'\0': self.output_path()}) as s:
s.execute('open "A:test" for output as 1: print#1, 42: close 1')
output = [_row.strip() for _row in self.get_text(s)]
assert output[0] == b'Path not found\xff'
with Session(devices={u'\xc4': self.output_path()}) as s:
s.execute('open "A:test" for output as 1: print#1, 42: close 1')
output = [_row.strip() for _row in self.get_text(s)]
assert output[0] == b'Path not found\xff'
def test_bad_current(self):
"""Test bad current device."""
with Session(devices={'A': self.output_path(), 'Z': None}, current_device='B') as s:
s.execute('open "test" for output as 1: print#1, 42: close 1')
assert os.path.isfile(self.output_path('TEST'))
with Session(devices={'A': self.output_path(), 'Z': None}, current_device='#') as s:
s.execute('open "test2" for output as 1: print#1, 42: close 1')
assert os.path.isfile(self.output_path('TEST2'))
def test_bytes_mount(self):
"""Test specifying mount dir as bytes."""
with Session(devices={'A': self.output_path().encode('ascii'), 'Z': None}) as s:
s.execute('open "test" for output as 1: print#1, 42: close 1')
assert os.path.isfile(self.output_path('TEST'))
# must be ascii
with Session(devices={'A': b'ab\xc2', 'Z': None}) as s:
s.execute('files')
output = [_row.strip() for _row in self.get_text(s)]
assert output[0] == b'@:\\'
def test_open_bad_device(self):
"""Test open on a bad device name."""
with Session(devices={b'A': self.output_path()}) as s:
s.execute('open "#:test" for output as 1: print#1, 42: close 1')
output = [_row.strip() for _row in self.get_text(s)]
assert output[0] == b'Bad file number\xff'
def test_open_null_device(self):
"""Test the NUL device."""
with Session(devices={b'A': self.output_path()}) as s:
s.execute('open "NUL" for output as 1: print#1, 42: close 1')
output = [_row.strip() for _row in self.get_text(s)]
assert output[0] == b''
def test_open_bad_number(self):
"""Test opening to a bad file number."""
with Session(devices={b'A': self.output_path()}, current_device='A') as s:
s.execute('open "TEST" for output as 4')
output = [_row.strip() for _row in self.get_text(s)]
assert output[0] == b'Bad file number\xff'
def test_open_reuse_number(self):
"""Test opening to a number taht's already in use."""
with Session(devices={b'A': self.output_path()}, current_device='A') as s:
s.execute('open "TEST" for output as 1')
s.execute('open "TEST2" for output as 1')
output = [_row.strip() for _row in self.get_text(s)]
assert output[0] == b'File already open\xff'
def test_long_filename(self):
"""Test handling of long filenames."""
names = (
b'LONG.FIL',
b'LONGFILE',
b'LONGFILE.BAS',
b'LongFileName',
b'Long.FileName',
b'LongFileName.BAS'
)
basicnames = {
b'LongFileName': b'LongFileName.BAS',
b'LongFileName.BAS': b'LongFileName.BAS',
b'Long.FileName': b'Long.FileName',
b'LongFileName2': b'LONGFILE.BAS',
b'LongFileName2.bas': b'LONGFILE.BAS',
b'LongFileName2.': b'LONGFILE',
b'Long.FileName.2': b'LONG.FIL'
}
with Session(devices={b'A': self.output_path()}) as s:
for name in names:
with open(os.path.join(self.output_path().encode('ascii'), name), 'wb') as f:
f.write(b'1000 a$="%s"\r\n' % (name,))
for name, found in basicnames.items():
s.execute(b'run "a:%s"' % (name,))
assert s.get_variable('a$') == found
def test_dot_filename(self):
"""Test handling of filenames ending in dots."""
# check for case insensitive file system
open(os.path.join(self.output_path(), 'casetest'), 'w').close()
is_case_insensitive = os.path.exists(os.path.join(self.output_path(), 'CASETEST'))
# check if os ignores dots at the end of file names (Windows does)
open(os.path.join(self.output_path(), 'dottest.'), 'w').close()
ignores_dots = os.path.exists(os.path.join(self.output_path(), 'dottest'))
names = (
b'LONG.FIL',
# these three will overwrite each other on Windows, write dotless one last
b'LONGFILE..',
b'LONGFILE.',
b'LONGFILE',
b'LONGFILE.BAS',
# these three will overwrite each other on Windows, write dotless one last
b'LongFileName..',
b'LongFileName.',
b'LongFileName',
b'Long.FileName',
b'Long.FileName.',
b'LongFileName.BAS',
# this will overwrite the previous on non-case-sensitive filesystems e.g. mac, windows
b'LongFileName.bas',
)
basicnames = {
b'LongFileName.bas': b'LongFileName.bas',
b'LongFileName': b'LongFileName.BAS',
# exact match if available
b'LongFileName.': b'LongFileName.',
b'LongFileName..': b'LongFileName..',
# use a dot at the end to suppress ".BAS"
b'LongFileName2': b'LONGFILE.BAS',
b'LongFileName2.bas': b'LONGFILE.BAS',
b'LongFileName2.': b'LONGFILE',
#b'LongFileName2..': # bad file name
# extension starts after first dot
b'Long.FileName.': b'Long.FileName.',
b'Long.FileName.2': b'LONG.FIL',
b'Long.FileName2..': b'LONG.FIL',
}
# the last of the case-equivalent writes wins
if is_case_insensitive:
basicnames[b'LongFileName'] = b'LongFileName.bas'
# the last of the dot-equivalent writes wins
if ignores_dots:
basicnames[b'LongFileName.'] = b'LongFileName'
basicnames[b'LongFileName..'] = b'LongFileName'
with Session(devices={b'A': self.output_path()}) as s:
for name in names:
with open(os.path.join(self.output_path().encode('ascii'), name), 'wb') as f:
f.write(b'1000 a$="%s"\r\n' % (name,))
for name, found in basicnames.items():
s.execute(b'run "a:%s"' % (name,))
assert s.get_variable('a$') == found, s.get_variable('a$') + b' != ' + found
def test_kill_long_filename(self):
"""Test deleting files with long filenames."""
names = (b'test.y', b'verylong.ext', b'veryLongFilename.ext')
for name in names:
open(os.path.join(self.output_path().encode('ascii'), name), 'wb').close()
with Session(devices={b'A': self.output_path()}) as s:
s.execute('kill "VERYLONG.EXT"')
assert not os.path.exists(b'verylong.ext')
s.execute('''
kill "VERYLONGFILENAME.EXT"
kill "VERYLONG.EXT"
kill "veryLongFilename.ext"
''')
output = [_row.strip() for _row in self.get_text(s)]
assert output[:3] == [b'File not found\xff']*3
if __name__ == '__main__':
run_tests()
|