Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
yen223
6 months ago
|
parent
|
context
|
favorite
| on:
Unit tests as documentation
Kotlin has an interesting approach to solving this. You can name functions using backticks, and in those backticks you can put basically anything.
So it's common to see unit tests like
@Test fun `this tests something very complicated`() { ... }
sfn42
6 months ago
[–]
You can do that in Java as well. Can't remember if it's exactly the same syntax
bunderbunder
6 months ago
|
parent
|
next
[–]
I don't think you can do it in Java specifically. But once upon a time it was rather popular to write test fixtures for Java code in Groovy, which does let you do it.
sfn42
6 months ago
|
root
|
parent
|
next
[–]
My bad, it seems I was misremembering
lmz
6 months ago
|
parent
|
prev
[–]
You can't put spaces in the function name, but you can set a display name for JUnit -
https://junit.org/junit5/docs/5.0.3/api/org/junit/jupiter/ap...
sfn42
6 months ago
|
root
|
parent
[–]
My bad, it seems I was misremembering
Join us for
AI Startup School
this June 16-17 in San Francisco!
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
So it's common to see unit tests like