Commit e42186d3 authored by Alex March's avatar Alex March Committed by Paul Sokolovsky

tests/extmod/vfs_fat: Replace asserts with prints and expected outputs.

parent f2f8ae11
...@@ -41,8 +41,8 @@ except MemoryError: ...@@ -41,8 +41,8 @@ except MemoryError:
uos.VfsFat.mkfs(bdev) uos.VfsFat.mkfs(bdev)
assert b"FOO_FILETXT" not in bdev.data print(b"FOO_FILETXT" not in bdev.data)
assert b"hello!" not in bdev.data print(b"hello!" not in bdev.data)
vfs = uos.VfsFat(bdev, "/ramdisk") vfs = uos.VfsFat(bdev, "/ramdisk")
print("statvfs:", vfs.statvfs("/ramdisk")) print("statvfs:", vfs.statvfs("/ramdisk"))
...@@ -57,10 +57,10 @@ f2 = vfs.open("foo_file.txt") ...@@ -57,10 +57,10 @@ f2 = vfs.open("foo_file.txt")
print(f2.read()) print(f2.read())
f2.close() f2.close()
assert b"FOO_FILETXT" in bdev.data print(b"FOO_FILETXT" in bdev.data)
assert b"hello!" in bdev.data print(b"hello!" in bdev.data)
assert vfs.listdir() == ['foo_file.txt'] print(vfs.listdir())
try: try:
vfs.rmdir("foo_file.txt") vfs.rmdir("foo_file.txt")
...@@ -68,10 +68,10 @@ except OSError as e: ...@@ -68,10 +68,10 @@ except OSError as e:
print(e.args[0] == 20) # uerrno.ENOTDIR print(e.args[0] == 20) # uerrno.ENOTDIR
vfs.remove('foo_file.txt') vfs.remove('foo_file.txt')
assert vfs.listdir() == [] print(vfs.listdir())
vfs.mkdir("foo_dir") vfs.mkdir("foo_dir")
assert vfs.listdir() == ['foo_dir'] print(vfs.listdir())
try: try:
vfs.remove("foo_dir") vfs.remove("foo_dir")
...@@ -82,18 +82,18 @@ f = vfs.open("foo_dir/file-in-dir.txt", "w") ...@@ -82,18 +82,18 @@ f = vfs.open("foo_dir/file-in-dir.txt", "w")
f.write("data in file") f.write("data in file")
f.close() f.close()
assert vfs.listdir("foo_dir") == ['file-in-dir.txt'] print(vfs.listdir("foo_dir"))
vfs.rename("foo_dir/file-in-dir.txt", "moved-to-root.txt") vfs.rename("foo_dir/file-in-dir.txt", "moved-to-root.txt")
assert vfs.listdir() == ['foo_dir', 'moved-to-root.txt'] print(vfs.listdir())
vfs.chdir("foo_dir") vfs.chdir("foo_dir")
print("getcwd:", vfs.getcwd()) print("getcwd:", vfs.getcwd())
assert vfs.listdir() == [] print(vfs.listdir())
with vfs.open("sub_file.txt", "w") as f: with vfs.open("sub_file.txt", "w") as f:
f.write("test2") f.write("test2")
assert vfs.listdir() == ["sub_file.txt"] print(vfs.listdir())
try: try:
vfs.chdir("sub_file.txt") vfs.chdir("sub_file.txt")
...@@ -116,9 +116,7 @@ vfs.umount() ...@@ -116,9 +116,7 @@ vfs.umount()
try: try:
vfs.listdir() vfs.listdir()
except OSError as e: except OSError as e:
assert e.args[0] == uerrno.ENODEV print(e.args[0] == uerrno.ENODEV)
else:
raise AssertionError("expected OSError not thrown")
vfs = uos.VfsFat(bdev, "/ramdisk") vfs = uos.VfsFat(bdev, "/ramdisk")
assert vfs.listdir() == ['moved-to-root.txt'] print(vfs.listdir())
True
True
statvfs: (512, 512, 14, 14, 14, 0, 0, 0, 0, 255) statvfs: (512, 512, 14, 14, 14, 0, 0, 0, 0, 255)
getcwd: /ramdisk getcwd: /ramdisk
hello! hello!
True True
True True
['foo_file.txt']
True
[]
['foo_dir']
True
['file-in-dir.txt']
['foo_dir', 'moved-to-root.txt']
getcwd: /ramdisk/foo_dir getcwd: /ramdisk/foo_dir
[]
['sub_file.txt']
True True
getcwd: /ramdisk getcwd: /ramdisk
True True
['moved-to-root.txt'] ['moved-to-root.txt']
True
['moved-to-root.txt']
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment