Rethink some of the logic
Always execute examples in a separate directory

It's a safe choice and the most common way to write tests will probably
be through intermediate files, so it makes some sense to do this by
default.