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

I debated and ended up leaving it like this because some of the tests depend on us not having all 3 buffers open and the thing we have to pass to `close_buffer` is a locally allocated variable.