Adds some tests.

Was there any particular reason you moved this out of the switch statement?  Looks like the same thing is accomplished both ways.