Break up .gitignore and correct its syntax.

Use leading / to indicate paths relative to the present directory,
move all the bits for tests/ into that sub-directory.

Provoked by discussion with @tzz.