Add tests. Fix bugs found by tests.

Add tests for breakOnEnter(), breakOnExit(), breakOnResult(), and
breakOnException().