March 29
https://issues.dlang.org/show_bug.cgi?id=24467

Jonathan M Davis <issues.dlang@jmdavisProg.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |issues.dlang@jmdavisProg.co
                   |                            |m

--- Comment #1 from Jonathan M Davis <issues.dlang@jmdavisProg.com> ---
They do not have the same syntax as functions. You can't declare something like
---
foo
{
}
---

It's missing both a return type and parens. On the other hand, that's exactly what you do with unittest blocks
---
unittest
{
}
---

If a unittest declaration were a function declaration, then it would look something like
---
void unittest()
{
}
---
which is illegal, because unittest declarations can't have return types or parens.

So, as far as declarations go, they're not function declarations. They're unittest declarations. They get implemented as functions underneath the hood, but their syntax is not the same, and as such, it makes no sense to support something like
---
unittest() => assert(1 == 1);
---

simply because you can do that with a function. I don't see how it can even be argued that the lambda syntax should be allowed for unittest declarations based on the fact that functions have it, because unittest declarations and function declarations do not share the same syntax. The only thing that's really the same is how their bodies work.

In addition, it's incredibly bad practice to write unittest blocks that contain only a single assertion. That's garbage test coverage and is the sort of thing that only makes sense in toy examples. As such, it makes no sense to add a shorter syntax that would encourage folks to write such terrible tests.

--