~sircmpwn/hare-users

4 2

Why `hare test` doesn't pick my unit test?

Details
Message ID
<CADC8Pp4uzS=tvPjCcY4E3rPjJLAQqHE+x91FgxHrKN1UmcnX0w@mail.gmail.com>
DKIM signature
pass
Download raw message
`hare test` pick up all unit test with the following folder structure:

```bash
# ...ignore another modules

├── protocols
│   ├── README
│   └── http
│       ├── +test
│       │   └── parser_test.ha
│       │   └── deinit_request_test.ha
│       ├── README
│       ├── errors.ha
│       ├── parser.ha
│       ├── request.ha
│       ├── status_code.ha
│       ├── types.ha
│       └── util.ha

# ...ignore another modules
```

But it doesn't pick up all http related unit tests after I restructure
like this:

```bash
# ...ignore another modules

├── protocols
│   ├── README
│   └── http
│       ├── +test
│       │   └── parser_test.ha
│       ├── request
│       │   ├── +test
│       │   │   └── deinit_test.ha
│       │   └── request.ha
│       ├── README
│       ├── errors.ha
│       ├── parser.ha
│       ├── status_code.ha
│       ├── types.ha
│       └── util.ha

# ...ignore another modules
```

`hare test` runs all detected unit tests, but ignore
`protocols/http/+test/parser_test.ha` and
`protocols/http/request/+test/deint_test.ha` without any error, could
I know why?
Details
Message ID
<65e985d2-6964-4f5f-ac00-8d33556ab9ae@strohwolke.at>
In-Reply-To
<CADC8Pp4uzS=tvPjCcY4E3rPjJLAQqHE+x91FgxHrKN1UmcnX0w@mail.gmail.com> (view parent)
DKIM signature
pass
Download raw message
On 18.12.24 04:42, Ye Wison wrote:
> `hare test` runs all detected unit tests, but ignore
> `protocols/http/+test/parser_test.ha` and
> `protocols/http/request/+test/deint_test.ha` without any error, could
> I know why?

Sometimes tests get skipped without warning, if there is an erroneous 
use statement.
Details
Message ID
<EBFD5A7C-BC91-4C08-BED3-70EA52902004@gmail.com>
In-Reply-To
<65e985d2-6964-4f5f-ac00-8d33556ab9ae@strohwolke.at> (view parent)
DKIM signature
pass
Download raw message
sorry, I didn't get it, could you have explain more:) Or the build driver doesn't support nested “+test” folder?


> On 18/12/2024, at 8:15 PM, Armin Preiml <apreiml@strohwolke.at> wrote:
> 
> On 18.12.24 04:42, Ye Wison wrote:
>> `hare test` runs all detected unit tests, but ignore
>> `protocols/http/+test/parser_test.ha` and
>> `protocols/http/request/+test/deint_test.ha` without any error, could
>> I know why?
> 
> Sometimes tests get skipped without warning, if there is an erroneous use statement.
Details
Message ID
<66acf83e-b578-4061-8e8f-b6a1c34b8c40@strohwolke.at>
In-Reply-To
<EBFD5A7C-BC91-4C08-BED3-70EA52902004@gmail.com> (view parent)
DKIM signature
pass
Download raw message
On 18.12.24 10:43, Ye Wison wrote:
> sorry, I didn't get it, could you have explain more:) Or the build driver doesn't support nested “+test” folder?

Check if your `use` statements are correct. A typo in them will cause 
the files to be skipped without message.

For example:

```
use byte;

@test fn test() void = {
	assert(bytes::equal([1u8], [1u8]));
};
```

Here the use statement is missing the "s" at the end.
Details
Message ID
<CADC8Pp6VPLw_M2xtuZxQy1eh7HXYo7rZgsJMvGzSW+J+AG4L9w@mail.gmail.com>
In-Reply-To
<66acf83e-b578-4061-8e8f-b6a1c34b8c40@strohwolke.at> (view parent)
DKIM signature
pass
Download raw message
Thanks for the pointer, but it doesn't work for my case:) I tried your
above code, but it didn't skip the particular test cases, instead, it
stopped running  all test cases, and it showed "No tests run":)

Also, when I tried to add few more folder and moved the test file
around, then I encount my prev posted question again:
xxxxx': `typedef variable $HARE_TD_xxx not set`


But if I create a new hare project, import (use) my current hare
project (I put it into the `third-party` folder), and run `hare run`
and `hare test`, then everything is fine.... I'm trying on Alpine
Linux.

On Wed, Dec 18, 2024 at 10:51 PM Armin Preiml <apreiml@strohwolke.at> wrote:
>
> On 18.12.24 10:43, Ye Wison wrote:
> > sorry, I didn't get it, could you have explain more:) Or the build driver doesn't support nested “+test” folder?
>
> Check if your `use` statements are correct. A typo in them will cause
> the files to be skipped without message.
>
> For example:
>
> ```
> use byte;
>
> @test fn test() void = {
>         assert(bytes::equal([1u8], [1u8]));
> };
> ```
>
> Here the use statement is missing the "s" at the end.
Reply to thread Export thread (mbox)