git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v7 2/3] unit tests: add TAP unit test framework

From
Pphillip.wood123@gmail.com <phillip.wood123@gmail.com>
Date
Sep 24, 2023, 13:57 UTC
Message-ID
<0b6de919-8dbf-454f-807b-5abb64388cb7@gmail.com>
In-Reply-To
<xmqqa5te0y9r.fsf@gitster.g>
Hi Junio
On 22/09/2023 21:05, Junio C Hamano wrote:
> It seems this got stuck during Josh's absense and I didn't ping it
> further, but I should have noticed that you are the author of this
> patch, and pinged you in the meantime.

Sorry I meant to reply when I saw your first message but then didn't get round to it.

> Any thought on the "polarity" of the return values from the
> assertion?  I still find it confusing and hard to follow.

When I was writing this I was torn between whether to follow our usual convention of returning zero for success and minus one for failure or to return one for success and zero for failure. In the end I decided to go with the former but I tend to agree with you that the latter would be easier to understand.

Show 12 quoted lines
>>> +test_expect_success 'TAP output from unit tests' '
>>> [...]
>>> +	ok 19 - test with no checks returns -1
>>> +	1..19
>>> +	EOF
>>
>> Presumably t-basic will serve as a catalog of check_* functions and
>> the test binary, together with this test piece, will keep growing as
>> we gain features in the unit tests infrastructure.  I wonder how
>> maintainable the above is, though.  When we acquire new test, we
>> would need to renumber.  What if multiple developers add new
>> features to the catalog at the same time?

I think we could just add new tests to the end so we'd only need to change the "1..19" line. That will become a source of merge conflicts if multiple developers add new features at the same time though. Having several unit test programs called from separate tests in t0080 might help with that.

Show 12 quoted lines
>>> diff --git a/t/unit-tests/.gitignore b/t/unit-tests/.gitignore
>>> new file mode 100644
>>> index 0000000000..e292d58348
>>> --- /dev/null
>>> +++ b/t/unit-tests/.gitignore
>>> @@ -0,0 +1,2 @@
>>> +/t-basic
>>> +/t-strbuf
>>
>> Also, can we come up with some naming convention so that we do not
>> have to keep adding to this file every time we add a new test
>> script?

Perhaps we should put the unit test binaries in a separate directory so we can just add that directory to .gitignore.

Best Wishes
Phillip
Previous: Junio C HamanoNext: Junio C Hamano
Message 21 of 67 in “unit tests: Add a project plan document”
  1. unit tests: Add a project plan documentJosh Steadmon, Jun 30, 2023
  2. Junio C HamanoJul 1, 2023
  3. Junio C HamanoJul 1, 2023
  4. unit tests: Add a project plan documentJosh Steadmon, Aug 7, 2023
  5. Phillip WoodAug 14, 2023
  6. Josh SteadmonAug 15, 2023
  7. Phillip WoodAug 17, 2023
  8. 0/3 Add unit test framework and project plan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bitJosh Steadmon, Aug 16, 2023
  9. 3/3 ci: run unit tests in CIJosh Steadmon, Aug 16, 2023
  10. 1/3 unit tests: Add a project plan documentJosh Steadmon, Aug 16, 2023
  11. 2/3 unit tests: add TAP unit test frameworkJosh Steadmon, Aug 16, 2023
  12. Junio C HamanoAug 17, 2023
  13. Junio C HamanoAug 17, 2023
  14. Josh SteadmonAug 17, 2023
  15. 0/3 Add unit test framework and project planJosh Steadmon, Aug 17, 2023
  16. 3/3 ci: run unit tests in CIJosh Steadmon, Aug 17, 2023
  17. 1/3 unit tests: Add a project plan documentJosh Steadmon, Aug 17, 2023
  18. 2/3 unit tests: add TAP unit test frameworkJosh Steadmon, Aug 17, 2023
  19. Junio C HamanoAug 18, 2023
  20. Junio C HamanoSep 22, 2023
  21. phillip.wood123@gmail.comSep 24, 2023
  22. Junio C HamanoSep 25, 2023
  23. Josh SteadmonOct 6, 2023
  24. Josh SteadmonOct 9, 2023
  25. Junio C HamanoAug 17, 2023
  26. Josh SteadmonAug 24, 2023
  27. Junio C HamanoSep 13, 2023
  28. 0/3 Add unit test framework and project planJosh Steadmon, Oct 9, 2023
  29. 1/3 unit tests: Add a project plan documentJosh Steadmon, Oct 9, 2023
  30. Oswald BuddenhagenOct 10, 2023
  31. Josh SteadmonOct 11, 2023
  32. Oswald BuddenhagenOct 11, 2023
  33. Josh SteadmonNov 1, 2023
  34. Christian CouderOct 27, 2023
  35. Josh SteadmonNov 1, 2023
  36. Junio C HamanoNov 1, 2023
  37. 2/3 unit tests: add TAP unit test frameworkJosh Steadmon, Oct 9, 2023
  38. Junio C HamanoOct 11, 2023
  39. 5/3 fixup! unit tests: add TAP unit test frameworkPhillip Wood, Oct 16, 2023
  40. Junio C HamanoOct 16, 2023
  41. Josh SteadmonNov 1, 2023
  42. Junio C HamanoNov 1, 2023
  43. Josh SteadmonNov 1, 2023
  44. Junio C HamanoNov 1, 2023
  45. Christian CouderOct 27, 2023
  46. Josh SteadmonNov 1, 2023
  47. 3/3 ci: run unit tests in CIJosh Steadmon, Oct 9, 2023
  48. Junio C HamanoOct 9, 2023
  49. 0/3 CMake unit test fixupsPhillip Wood, Oct 19, 2023
  50. 1/3 fixup! cmake: also build unit testsPhillip Wood, Oct 19, 2023
  51. 2/3 fixup! artifacts-tar: when including `.dll` files, don't forget the unit-testsPhillip Wood, Oct 19, 2023
  52. 3/3 fixup! cmake: handle also unit testsPhillip Wood, Oct 19, 2023
  53. Junio C HamanoOct 19, 2023
  54. phillip.wood123@gmail.comOct 16, 2023
  55. Josh SteadmonNov 1, 2023
  56. Christian CouderOct 27, 2023
  57. 0/3 Add unit test framework and project planJosh Steadmon, Nov 1, 2023
  58. 1/3 unit tests: Add a project plan documentJosh Steadmon, Nov 1, 2023
  59. 3/3 ci: run unit tests in CIJosh Steadmon, Nov 1, 2023
  60. 2/3 unit tests: add TAP unit test frameworkJosh Steadmon, Nov 1, 2023
  61. Christian CouderNov 3, 2023
  62. Josh SteadmonNov 9, 2023
  63. 0/3 Add unit test framework and project planJosh Steadmon, Nov 9, 2023
  64. 1/3 unit tests: Add a project plan documentJosh Steadmon, Nov 9, 2023
  65. Junio C HamanoNov 9, 2023
  66. 2/3 unit tests: add TAP unit test frameworkJosh Steadmon, Nov 9, 2023
  67. 3/3 ci: run unit tests in CIJosh Steadmon, Nov 9, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.