-
-
Notifications
You must be signed in to change notification settings - Fork 90
fix behavior of nth with default argument #294
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
fix behavior of nth with default argument #294
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the unit tests, they're in a separate repo that aspires to be a common base of tests for all Clojure distributions. Tests for core functions won't be accepted here.
Instead, add your tests here https://github.com/jank-lang/clojure-test-suite/blob/main/test/clojure/core_test/nth.cljc and make sure they at least work in clj/cljs.
Then remove them from this PR.
We're in an unfortunate period where the unit tests for nth don't yet work in jank, as documented here.
So please manually try them with jank repl and paste the results in the PR.
In terms of the change, it looks good to me. Could you make the diff a single line, just the return statement without ws changes or tests?
There is a formatter, but it shouldn't bother this PR. I use git clang-format main
to fix up my formatting.
Could you also add |
400591e
to
ceecbaf
Compare
Added tests in nth.cljc would look like this:
They pass when running
I've added them in the subrepo in another PR : jank-lang/clojure-test-suite#82 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick change! Please address the CI failure. It failed because the branch you changed is now identical to the branch above it, so they can be merged.
After making the change, please request another review.
5bbc059
to
1603750
Compare
Thanks for the ping. I don't see any changes, though. 🙃 Not going to trigger CI again, since it'll say the same thing. Right now the code has this. if(index < 0)
{
return fallback;
}
else if(o == obj::nil::nil_const())
{
return fallback;
} Static analysis is complaining about these two branch bodies being identical, so we need to combine them. if(index < 0 || o == obj::nil::nil_const())
{
return fallback;
} |
Oh, sorry, I misread your comment and I thought you were talking about git branches, not the conditional branches 🤦 I'll fix that, sorry again! |
I fixed the code, normally. |
Thanks for the fix! |
Closes #275
@frenchy64:
Note that tests where not all passing on my machine, so I had to run it as
/bin/test -tc=nth
I don't know if the naming is proper for the test
I don't know if there is a formater, etc...