What's the usual way to test a private function? #1490
Unanswered
hatzka-nezumi
asked this question in
Q&A
Replies: 1 comment
-
Not sure if there is an idiom or a usual way. There is some discussion about testing private things here. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Most of my recent programming has been Rust (not that I've liked the language overall... but that's why I'm here). In Rust, the idiomatic way to structure tests is to put them in the same file as the code being tested and remove them from non-test builds with what boils down to an
#ifdef
. This means tests can easily access non-exported names from the parent module.In Janet, on the other hand, it seems like the idiom is to put tests in separate files, which means they can't access private functions. Unless I'm missing something?
Beta Was this translation helpful? Give feedback.
All reactions