Skip to content
Snippets Groups Projects
Commit f0eea1fd authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

tests/extmod/vfs_fat_ramdisk: Add testcases for chdir(), getcwd().

parent ee5e3f65
Branches
No related tags found
No related merge requests found
......@@ -45,6 +45,8 @@ assert b"hello!" not in bdev.data
vfs = uos.VfsFat(bdev, "/ramdisk")
print("getcwd:", vfs.getcwd())
f = vfs.open("foo_file.txt", "w")
f.write("hello!")
f.close()
......@@ -71,3 +73,14 @@ assert vfs.listdir("foo_dir") == ['file-in-dir.txt']
vfs.rename("foo_dir/file-in-dir.txt", "moved-to-root.txt")
assert vfs.listdir() == ['foo_dir', 'moved-to-root.txt']
vfs.chdir("foo_dir")
print("getcwd:", vfs.getcwd())
assert vfs.listdir() == []
with vfs.open("sub_file.txt", "w") as f:
f.write("test2")
assert vfs.listdir() == ["sub_file.txt"]
vfs.chdir("..")
print("getcwd:", vfs.getcwd())
getcwd: /ramdisk
hello!
getcwd: /ramdisk/foo_dir
getcwd: /ramdisk
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment