There were a couple of problems with the implementation:
the pre hook was called before yielding a directory. This isn't
wrong so much as inconvenient -- you can't indent on pre-, and
outdent on post-, for example.
the post hook was called at the top of the stack, i.e., when
leaving the starting point, so everything had some variety of
off-by-one problem.
This commits makes the tests a bit more rigorous (the post-hook test
in particular didn't check that the number of times leaving a
directory was equal to the number of times entering a
directory!). I've also given the walk procedure some typedocs, so it
has a better explanation in the API reference.
There were a couple of problems with the implementation:
the pre hook was called before yielding a directory. This isn't wrong so much as inconvenient -- you can't indent on pre-, and outdent on post-, for example.
the post hook was called at the top of the stack, i.e., when leaving the starting point, so everything had some variety of off-by-one problem.
This commits makes the tests a bit more rigorous (the post-hook test in particular didn't check that the number of times leaving a directory was equal to the number of times entering a directory!). I've also given the walk procedure some typedocs, so it has a better explanation in the API reference.