More comprehensive test suite.

I plan to work on the new feature - cleaning up after views, but first I wrote comprehensive tests for the existing functionality so I make sure I don't accidentally break stuff.