Basic automated tests for region/target handling

These won't catch everything, but they're a start and better than testing repeatedly by hand!