-
Notifications
You must be signed in to change notification settings - Fork 23
test fn?
#104
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
test fn?
#104
Conversation
This is arguably an implementation detail and not worth testing. Included for completeness nonetheless.
8d52af6
to
816488c
Compare
Test fails because babashka implements protocols with multimethods. This is a good canary case: do we care if protocols are |
To me, this is an implementation detail which is good to identify and document. I think your test for this, and your reasoning, is good. Let's skip the test for @borkdude for vis. |
Looks overly specific. Why not test for IFn instead?
https://www.michielborkent.nl
https://www.eetvoorjeleven.nu
…On Fri, 5 Sep 2025 at 19:28, Jeaye Wilkerson ***@***.***> wrote:
*jeaye* left a comment (jank-lang/clojure-test-suite#104)
<#104 (comment)>
Test fails because babashka implements protocols with multimethods. This
is a good canary case: do we care if protocols are fn? or is that an
implementation detail and we should remove that test (and possibly
multimethods too)?
To me, this is an implementation detail which is good to identify and
document. I think your test for this, and your reasoning, is good. Let's
skip the test for :bb in a reader conditional, with a comment explaining
that babashka uses multimethods for this. Sound good?
@borkdude <https://github.com/borkdude> for vis.
—
Reply to this email directly, view it on GitHub
<#104 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACFSBTL4KWRIUT7UECZSJL3RHB4NAVCNFSM6AAAAACFWWX43KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTENJZGIYTOMBZHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
These are the unit tests for |
What are you basing these tests on, documentation or just poking and seeing
which things are fn? In Clojure? If the latter is the method of coming to a
test suite like this I think you may end up testing overly specific things
https://www.michielborkent.nl
https://www.eetvoorjeleven.nu
…On Fri, 5 Sep 2025 at 19:49, Jeaye Wilkerson ***@***.***> wrote:
*jeaye* left a comment (jank-lang/clojure-test-suite#104)
<#104 (comment)>
Looks overly specific. Why not test for IFn instead?
These are the unit tests for clojure.core/fn?. We're just exercising
different inputs to that to characterize which things in Clojure are
functions.
—
Reply to this email directly, view it on GitHub
<#104 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACFSBRRO7RB2DQS3QGK7WD3RHEK7AVCNFSM6AAAAACFWWX43KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTENJZGI3DINRYHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
We're supporting Clojure, ClojureScript, Clojure CLR, babashka, and working on jank support, right now. The tests are written to target all of them and point out any discrepancies or idiosyncrasies we find. These are good things to indentify. We would all say that each of these dialects is "Clojure", but nobody knows exactly what "Clojure" is. This test suite is one way to help us figure out how similar (and dissimilar) each of these dialects are. The fact that babashka uses multi-methods for protocols is not a problem, but it's a good thing to note, since it has implications for how those protocols interact with the rest of the system. |
The fact that bb uses multimethods for protocol fns is an implementation
detail that may change any day and not something anyone should rely on. If
someone were to make a bb compat test suite for an alternative bb written
in COBOL, this isn’t something I would like them to imitate :)
https://www.michielborkent.nl
https://www.eetvoorjeleven.nu
…On Fri, 5 Sep 2025 at 20:04, Jeaye Wilkerson ***@***.***> wrote:
*jeaye* left a comment (jank-lang/clojure-test-suite#104)
<#104 (comment)>
What are you basing these tests on, documentation or just poking and
seeing which things are fn? In Clojure? If the latter is the method of
coming to a test suite like this I think you may end up testing overly
specific things
We're supporting Clojure, ClojureScript, Clojure CLR, babashka, and
working on jank support, right now. The tests are written to target all of
them and point out any discrepancies or idiosyncrasies we find. These are
good things to indentify.
We would all say that each of these dialects is "Clojure", but nobody
knows exactly what "Clojure" is. This test suite is one way to help us
figure out how similar (and dissimilar) each of these dialects are. The
fact that babashka uses multi-methods for protocols is not a problem, but
it's a good thing to note, since it has implications for how those
protocols interact with the rest of the system.
—
Reply to this email directly, view it on GitHub
<#104 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACFSBTQ7GVQ2SBWXN2EDYD3RHGBFAVCNFSM6AAAAACFWWX43KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTENJZGI4TQMZVGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I understand your point. Thanks for taking the time to weigh in and discuss. @daveliepmann, I think borkdude brings up fair criticism that this is beyond the scope of the behavior |
I think for protocols it would be good to add a test around the behavior of protocols though, including |
And stuff like multi-arity functions in protocols, etc. |
We're just focused on unit testing core functions (i.e. all of Not until this project, anyway! |
Thanks for clarifying. I still think it would be great to have such tests since I've fixed quite a number of corner cases in SCI while developing protocols and other features. But clojure.core fns are a great way to start. As Erik Assum has hinted, https://github.com/borkdude/speculative may also be of some value/inspiration to this project, since that project contains specs for clojure.core functions. It's not in any way comprehensive though. The issue tracker of that project contains some interesting discussions with Alex as well. Anyway, thanks for this test suite and thank you @daveliepmann for improving it! |
Agreed that it got too specific there. I removed the tests that rely on implementation details and left a comment explaining the reasoning. I feel much better about this namespace's testing scope now. Thanks for the discussion! |
@@ -0,0 +1,34 @@ | |||
(ns clojure.core-test.fn-qmark | |||
(:require clojure.core |
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.
Requiring clojure.core
here should be redundant
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.
No opinion — see b617559 and
(:require {{base-ns}} |
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.
Looks great, Dave! 💪
No description provided.