-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cljr--find-source-ns-of-test-ns can choose the wrong namespace when there are multiple matches #407
Comments
Hi, thanks for taking an interest! I'm not sure if we need two passes (candidates and then final selection). Perhaps the code would just do the right thing if we checked for equality instead? Given a test buffer
We definitely need to handle the other case too, because some people like to write the tests before the implementation. |
If the Take the test namespace, 'day10-test' in this case (with the ns being derived from the buffer name). It looks in the If we only care about the |
Looking at the tests, the feature is definitely intended to match aribtrary prefixes and suffixes. Here's an addition to the test cases the demonstrate the problem:
This causes multiple failures. Here's one:
|
The sut can choose the wrong namespace when there are multiple partial matches. For example, given a source tree with:
Creating a new buffer named
test/advent/day10_test.clj
results in:When we'd expect:
I have a partial fix at orb@a8306c2. I did not submit a PR because I didn't meet all the contribution requirements yet. However, the basic idea was that instead of finding the first matching file, we'd find the longest matching file.
This solution works well when the
sut
class exists. If, in this example,src/advent/day10.clj
did not exist yet, it would still chooseadvent.day1
as the best match. I don't like that, but I'm not sure how to best fix that and still maintain the flexibility the code is apparently trying to achieve.The text was updated successfully, but these errors were encountered: