From cda09727b451b6b928cc0129c4be7d3127f1aaad Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 13 May 2017 19:10:15 +1000 Subject: [PATCH] tests/extmod/vfs_fat: Add test for ilistdir of a non-existent directory. --- tests/extmod/vfs_fat_ramdisk.py | 6 ++++++ tests/extmod/vfs_fat_ramdisk.py.exp | 1 + 2 files changed, 7 insertions(+) diff --git a/tests/extmod/vfs_fat_ramdisk.py b/tests/extmod/vfs_fat_ramdisk.py index 89b40e3a24..fe72a8beff 100644 --- a/tests/extmod/vfs_fat_ramdisk.py +++ b/tests/extmod/vfs_fat_ramdisk.py @@ -93,3 +93,9 @@ uos.umount(vfs) vfs = uos.VfsFat(bdev) print(list(vfs.ilistdir(b""))) + +# list a non-existent directory +try: + vfs.ilistdir(b"no_exist") +except OSError as e: + print('ENOENT:', e.args[0] == uerrno.ENOENT) diff --git a/tests/extmod/vfs_fat_ramdisk.py.exp b/tests/extmod/vfs_fat_ramdisk.py.exp index 6298a7efdc..ccd0f7134c 100644 --- a/tests/extmod/vfs_fat_ramdisk.py.exp +++ b/tests/extmod/vfs_fat_ramdisk.py.exp @@ -13,3 +13,4 @@ getcwd: /foo_dir True getcwd: / [(b'foo_file.txt', 32768, 0), (b'foo_dir', 16384, 0)] +ENOENT: True