add tests for replacing dir with file and file with dir