Add non-directory detection tests and some associated comments