Improved the readline test method to match the real readline behavior.