Move test utilities into their own subdirectory

- use a named return for err