   end
 
   test :invalid_cd! do
-    message = "could not set current working directory to #{fixture_path("file.txt")}: not a directory"
+    message = %r"^could not set current working directory to #{escape fixture_path("file.txt")}: (not a directory|no such file or directory)"
     assert_raise File.Error, message, fn ->
       File.cd!(fixture_path("file.txt"))
     end


  test :touch_with_failure! do
    fixture = fixture_path("file.txt/bar")
    assert_raise File.Error, "could not touch #{fixture}: not a directory", fn ->
      File.touch!(fixture)
    end
  end

      fixture = fixture_path("file.txt")
      invalid = Path.join fixture, "test"
      assert File.exists?(fixture)
      assert_raise File.Error, %r"^could not make directory \(with -p\) #{escape invalid}: (not a directory|no such file or directory)", fn ->
        File.mkdir_p!(invalid)
      end
    end
