Added a check for an overflow to String::toInt().

Relevant to #363.
Also removed some redundant tests and added a one for an overflow.