Fix minor bugs in the code.

It turns out `isFile` throws on non-existing files - doesn't make a lot
of sense to me, but alright; we'll use a composition of `isFile` &&
`exists`.
Add simple unit-tests for the `redoPath` function.

This is a good practice. I'll try writing tests for what I write, as I
go along.