Unit tests for the file loader

There is a segfault to fix.