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

Can you give the specific errors you're getting?