Update find matching test funcs.

When candidates are more than 1, look up to the dirnames and try to find best matched file.
In this way, we can take advantage of dirname based namespace rules.
If the best matched file is not clear, it behaves like it did.
Merge pull request #467 from kayhide/master

Update find matching test funcs.