[WIP/RFC] Add unit tests for buffer.c and fileio.c

these can probably go in a `after_each`, even if some buffers aren't used for some tests.