It was getting way too ad-hoc in there. Let's reorganize the tests so that there's a good, obvious, suggested sequence to run them in.
This has something to do with resource forks. So use "-d filename/." instead, which returns false if filename is not a directory.