Thread overview | |||||
---|---|---|---|---|---|
|
March 22, 2020 can a unittest read main()'s args? | ||||
---|---|---|---|---|
| ||||
I have a module with a unittest { ... } block. However, when I run dub test sometimes I want to output some extra data when the test runs. At the moment I control this by using an environment variable, but I wondered if it was possible to pass a command line argument 'dub test myarg' and if so how to access it? |
March 22, 2020 Re: can a unittest read main()'s args? | ||||
---|---|---|---|---|
| ||||
Posted in reply to mark | On 22/03/2020 8:57 PM, mark wrote: > I have a module with a unittest { ... } block. However, when I run dub test sometimes I want to output some extra data when the test runs. At the moment I control this by using an environment variable, but I wondered if it was possible to pass a command line argument 'dub test myarg' and if so how to access it? dub run -- args https://dlang.org/phobos/core_runtime.html#.Runtime.args |
March 22, 2020 Re: can a unittest read main()'s args? | ||||
---|---|---|---|---|
| ||||
Posted in reply to rikki cattermole | On Sunday, 22 March 2020 at 07:59:01 UTC, rikki cattermole wrote:
> On 22/03/2020 8:57 PM, mark wrote:
>> I have a module with a unittest { ... } block. However, when I run dub test sometimes I want to output some extra data when the test runs. At the moment I control this by using an environment variable, but I wondered if it was possible to pass a command line argument 'dub test myarg' and if so how to access it?
>
> dub run -- args
>
> https://dlang.org/phobos/core_runtime.html#.Runtime.args
Thanks, that works great!
|
Copyright © 1999-2021 by the D Language Foundation