Add tests for functions and user types.
More tests; in particular, for errors.