Rework and extend the unicode branch/ref name tests. Fixes #361.