diff options
| author | Ayke van Laethem <aykevanlaethem@gmail.com> | 2017-12-19 23:47:07 +0100 |
|---|---|---|
| committer | Jeff Epler <jepler@unpythonic.net> | 2018-03-23 09:19:56 -0500 |
| commit | fa55b15ac6a15be0c11123753760324547518a18 (patch) | |
| tree | bff0be89042dc49b776ddba0309e2c0bd0644ef2 /tests/extmod | |
| parent | 9ab39eb2d286276edd5dd70612d2d6f6c48b71a0 (diff) | |
extmod/vfs_fat_file: Implement SEEK_CUR for non-zero offset.
CPython doesn't allow SEEK_CUR with non-zero offset for files in text mode,
and uPy inherited this behaviour for both text and binary files. It makes
sense to provide full support for SEEK_CUR of binary-mode files in uPy, and
to do this in a minimal way means also allowing to use SEEK_CUR with
non-zero offsets on text-mode files. That seems to be a fair compromise.
Diffstat (limited to 'tests/extmod')
| -rw-r--r-- | tests/extmod/vfs_fat_fileio1.py | 6 | ||||
| -rw-r--r-- | tests/extmod/vfs_fat_fileio1.py.exp | 2 |
2 files changed, 3 insertions, 5 deletions
diff --git a/tests/extmod/vfs_fat_fileio1.py b/tests/extmod/vfs_fat_fileio1.py index d19df120b..8b9ff92eb 100644 --- a/tests/extmod/vfs_fat_fileio1.py +++ b/tests/extmod/vfs_fat_fileio1.py @@ -91,10 +91,8 @@ with open("foo_file.txt") as f2: f2.seek(0, 1) # SEEK_CUR print(f2.read(1)) - try: - f2.seek(1, 1) # SEEK_END - except OSError as e: - print(e.args[0] == uerrno.EOPNOTSUPP) + f2.seek(2, 1) # SEEK_CUR + print(f2.read(1)) f2.seek(-2, 2) # SEEK_END print(f2.read(1)) diff --git a/tests/extmod/vfs_fat_fileio1.py.exp b/tests/extmod/vfs_fat_fileio1.py.exp index d777585cf..a66f07605 100644 --- a/tests/extmod/vfs_fat_fileio1.py.exp +++ b/tests/extmod/vfs_fat_fileio1.py.exp @@ -7,7 +7,7 @@ hello!world! 12 h e -True +o d True [('foo_dir', 16384, 0)] |
