Implement str.[r]index() and add tests for them.