test: fix cwd_and_chdir test on Unix

It was broken since for ever, but e8c4c329e69fff1b656c833883997ac663ea48ef added the assert which made it blow up on Unix.

R=@piscisaureus
I don't really know what the change is supposed to do. Did you mean to check if the path ends with a slash, and if so, remove it?