Let’s create and open a file in our current working directory, write to it, and
then read from it. Here we have to use .seekTo to go back to the start of the
file before reading what we have written.
The functions
std.fs.openFileAbsolute
and similar absolute functions exist, but we will not test them here.
We can get various information about files by using .stat() on them. Stat
also contains fields for .inode and .mode, but they are not tested here as they
rely on the current OS’ types.
When the Enum type is known from context, it can be omitted, so we can
compare stat.kind to .file instead of Kind.file.
We can make directories and iterate over their contents. Here we will use an
iterator (discussed later). This directory (and its contents) will be deleted
after this test finishes.