Improved reload-code error messages and added tests.

Fixes https://github.com/pry/pry/issues/1022 and https://github.com/pry/pry/issues/1046. I am new to pry's code base so there may be some use cases that I haven't thought of and some opportunities to refactor.

I used the patch from https://github.com/pry/pry/issues/1046 (which I assume to be correct) and added an if statement to satisfy @kyrylo's test case https://gist.github.com/kyrylo/6e318d06dceddd8e8230. 

I Added a test for the old `reload_code` functionality and a test for the new functionality.