Add boilerplate stuff in cask-test.
Major refactoring.

Yes, I am really ashamed about this commit. It quickly got out of hand,
so this now includes a number of changes:

* All private functions are prefixed with cask--
* Link functions take symbols as arguments
* Don't use functions that require to setup an environment
  internally. Create private functions for those.
* Add a lot of tests
* And probably more...