tomd: extract common test setup
tomd: support empty or null prefixes -- fixes #8