Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
e42186d3
Commit
e42186d3
authored
Oct 12, 2016
by
Alex March
Committed by
Paul Sokolovsky
Oct 13, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests/extmod/vfs_fat: Replace asserts with prints and expected outputs.
parent
f2f8ae11
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
15 deletions
+26
-15
tests/extmod/vfs_fat_ramdisk.py
tests/extmod/vfs_fat_ramdisk.py
+13
-15
tests/extmod/vfs_fat_ramdisk.py.exp
tests/extmod/vfs_fat_ramdisk.py.exp
+13
-0
No files found.
tests/extmod/vfs_fat_ramdisk.py
View file @
e42186d3
...
...
@@ -41,8 +41,8 @@ except MemoryError:
uos
.
VfsFat
.
mkfs
(
bdev
)
assert
b"FOO_FILETXT"
not
in
bdev
.
data
assert
b"hello!"
not
in
bdev
.
data
print
(
b"FOO_FILETXT"
not
in
bdev
.
data
)
print
(
b"hello!"
not
in
bdev
.
data
)
vfs
=
uos
.
VfsFat
(
bdev
,
"/ramdisk"
)
print
(
"statvfs:"
,
vfs
.
statvfs
(
"/ramdisk"
))
...
...
@@ -57,10 +57,10 @@ f2 = vfs.open("foo_file.txt")
print
(
f2
.
read
())
f2
.
close
()
assert
b"FOO_FILETXT"
in
bdev
.
data
assert
b"hello!"
in
bdev
.
data
print
(
b"FOO_FILETXT"
in
bdev
.
data
)
print
(
b"hello!"
in
bdev
.
data
)
assert
vfs
.
listdir
()
==
[
'foo_file.txt'
]
print
(
vfs
.
listdir
())
try
:
vfs
.
rmdir
(
"foo_file.txt"
)
...
...
@@ -68,10 +68,10 @@ except OSError as e:
print
(
e
.
args
[
0
]
==
20
)
# uerrno.ENOTDIR
vfs
.
remove
(
'foo_file.txt'
)
assert
vfs
.
listdir
()
==
[]
print
(
vfs
.
listdir
())
vfs
.
mkdir
(
"foo_dir"
)
assert
vfs
.
listdir
()
==
[
'foo_dir'
]
print
(
vfs
.
listdir
())
try
:
vfs
.
remove
(
"foo_dir"
)
...
...
@@ -82,18 +82,18 @@ f = vfs.open("foo_dir/file-in-dir.txt", "w")
f
.
write
(
"data in file"
)
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"
)
assert
vfs
.
listdir
()
==
[
'foo_dir'
,
'moved-to-root.txt'
]
print
(
vfs
.
listdir
())
vfs
.
chdir
(
"foo_dir"
)
print
(
"getcwd:"
,
vfs
.
getcwd
())
assert
vfs
.
listdir
()
==
[]
print
(
vfs
.
listdir
())
with
vfs
.
open
(
"sub_file.txt"
,
"w"
)
as
f
:
f
.
write
(
"test2"
)
assert
vfs
.
listdir
()
==
[
"sub_file.txt"
]
print
(
vfs
.
listdir
())
try
:
vfs
.
chdir
(
"sub_file.txt"
)
...
...
@@ -116,9 +116,7 @@ vfs.umount()
try
:
vfs
.
listdir
()
except
OSError
as
e
:
assert
e
.
args
[
0
]
==
uerrno
.
ENODEV
else
:
raise
AssertionError
(
"expected OSError not thrown"
)
print
(
e
.
args
[
0
]
==
uerrno
.
ENODEV
)
vfs
=
uos
.
VfsFat
(
bdev
,
"/ramdisk"
)
assert
vfs
.
listdir
()
==
[
'moved-to-root.txt'
]
print
(
vfs
.
listdir
())
tests/extmod/vfs_fat_ramdisk.py.exp
View file @
e42186d3
True
True
statvfs: (512, 512, 14, 14, 14, 0, 0, 0, 0, 255)
getcwd: /ramdisk
hello!
True
True
['foo_file.txt']
True
[]
['foo_dir']
True
['file-in-dir.txt']
['foo_dir', 'moved-to-root.txt']
getcwd: /ramdisk/foo_dir
[]
['sub_file.txt']
True
getcwd: /ramdisk
True
['moved-to-root.txt']
True
['moved-to-root.txt']
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment