tests/extmod/vfs_fat_ramdisk: Add testcases for chdir(), getcwd().
This commit is contained in:
parent
ee5e3f6527
commit
f0eea1fdf9
@ -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())
|
||||
|
@ -1 +1,4 @@
|
||||
getcwd: /ramdisk
|
||||
hello!
|
||||
getcwd: /ramdisk/foo_dir
|
||||
getcwd: /ramdisk
|
||||
|
Loading…
Reference in New Issue
Block a user