The attached patch adds a regression test for this bug, as well as a couple other basic functionality tests for insert-directory. This does not test the other unfixed cases still in ls-lisp.el and tramp-sh.el, but I thought it prudent to get these tests in before trying to apply them in other libraries. Along those lines, I also attempted to skip the test when ls-lisp would be used during files-tests.el, which I predict might happen when building on Windows? I sent in my copyright assignment, but I think it's still being finalized. Thank you!