unittest "name" {}
Steven Schveighoffer
schveiguy at gmail.com
Thu Feb 16 15:36:25 UTC 2023
On 2/16/23 5:40 AM, IGotD- wrote:
> On Friday, 10 February 2023 at 21:48:00 UTC, Steven Schveighoffer wrote:
>>
>> If you are going that route, just `unittest Johnny` would be fine.
>>
>
> I'm actually for that it should be unittest "Johnny" instead of without
> the quotations. The reason is that we want something that describes the
> test much as possible and that will often include spaces.
>
> For example:
>
> unittest "Johnny download test fail to find server"
>
> instead of
>
> unittest Johnny download test fail to find server
>
> which certainly will confuse the parser.
>
> You can overcome this by having snake case but that it kind of ugly
>
> unittest Johnny_download_test_fail_to_find_server
>
>
> With quotation marks we will have more freedom how to name the tests.
I actually prefer without the quotes. Why? Because it matches what we
currently do:
struct foo
class bar
unittest baz
In addition, if you make it a string, since D has CTFE, this is going to
get confusing:
sneaky.d:
enum Johnny = "Freddy";
othermodule.d:
unittest Johnny {
}
"unittest Freddy failed"
user: huh?
So you have to come up with a name that has no spaces. Are you a
programmer or not?
I would couch this by saying, I don't really think we need anything
here. The @("Johnny") is good enough for me. In fact, I'm fine without
labeling unittests at all, and just looking at the file/line of the
failed tests.
-Steve
More information about the Digitalmars-d
mailing list