<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/t/unit-tests, branch v2.46.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.46.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.46.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2024-08-26T18:10:24Z</updated>
<entry>
<title>Merge branch 'rs/t-example-simplify' into maint-2.46</title>
<updated>2024-08-26T18:10:24Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-08-26T18:10:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=164cffa35c487f46fa1483ae4a616c45fd3a2bdf'/>
<id>urn:sha1:164cffa35c487f46fa1483ae4a616c45fd3a2bdf</id>
<content type='text'>
Unit test simplification.

* rs/t-example-simplify:
  t-example-decorate: remove test messages
</content>
</entry>
<entry>
<title>t-example-decorate: remove test messages</title>
<updated>2024-07-30T20:31:46Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2024-07-30T14:00:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=098be29f5b4e40b687529d65166c19e6bb096dcb'/>
<id>urn:sha1:098be29f5b4e40b687529d65166c19e6bb096dcb</id>
<content type='text'>
The test_msg() calls only repeat information already present in test
descriptions and check definitions, which are shown automatically if
the checks fail.  Remove the redundant messages to simplify the tests
and their output.  Here it is with all of them failing before:

 # check "ret == NULL" failed at t/unit-tests/t-example-decorate.c:18
 # when adding a brand-new object, NULL should be returned
 # check "ret == NULL" failed at t/unit-tests/t-example-decorate.c:21
 # when adding a brand-new object, NULL should be returned
 not ok 1 - Add 2 objects, one with a non-NULL decoration and one with a NULL decoration.
 # check "ret == &amp;vars-&gt;decoration_a" failed at t/unit-tests/t-example-decorate.c:29
 # when readding an already existing object, existing decoration should be returned
 # check "ret == NULL" failed at t/unit-tests/t-example-decorate.c:32
 # when readding an already existing object, existing decoration should be returned
 not ok 2 - When re-adding an already existing object, the old decoration is returned.
 # check "ret == NULL" failed at t/unit-tests/t-example-decorate.c:40
 # lookup should return added declaration
 # check "ret == &amp;vars-&gt;decoration_b" failed at t/unit-tests/t-example-decorate.c:43
 # lookup should return added declaration
 # check "ret == NULL" failed at t/unit-tests/t-example-decorate.c:46
 # lookup for unknown object should return NULL
 not ok 3 - Lookup returns the added declarations, or NULL if the object was never added.
 # check "objects_noticed == 2" failed at t/unit-tests/t-example-decorate.c:58
 #    left: 1
 #   right: 2
 # should have 2 objects
 not ok 4 - The user can also loop through all entries.
 1..4

... and here with the patch applied:

 # check "ret == NULL" failed at t/unit-tests/t-example-decorate.c:18
 # check "ret == NULL" failed at t/unit-tests/t-example-decorate.c:20
 not ok 1 - Add 2 objects, one with a non-NULL decoration and one with a NULL decoration.
 # check "ret == &amp;vars-&gt;decoration_a" failed at t/unit-tests/t-example-decorate.c:27
 # check "ret == NULL" failed at t/unit-tests/t-example-decorate.c:29
 not ok 2 - When re-adding an already existing object, the old decoration is returned.
 # check "ret == NULL" failed at t/unit-tests/t-example-decorate.c:36
 # check "ret == &amp;vars-&gt;decoration_b" failed at t/unit-tests/t-example-decorate.c:38
 # check "ret == NULL" failed at t/unit-tests/t-example-decorate.c:40
 not ok 3 - Lookup returns the added declarations, or NULL if the object was never added.
 # check "objects_noticed == 2" failed at t/unit-tests/t-example-decorate.c:51
 #    left: 1
 #   right: 2
 not ok 4 - The user can also loop through all entries.
 1..4

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>unit-tests/test-lib: fix typo in check_pointer_eq() description</title>
<updated>2024-07-29T21:23:14Z</updated>
<author>
<name>Kousik Sanagavarapu</name>
<email>five231003@gmail.com</email>
</author>
<published>2024-07-29T04:32:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6e71d6ac7cb575d04c452762662b00a89cd0b0db'/>
<id>urn:sha1:6e71d6ac7cb575d04c452762662b00a89cd0b0db</id>
<content type='text'>
The comment surrounding check_pointer_eq() should explain about what
this function does instead of explaining check_int().  Correct this.

Signed-off-by: Kousik Sanagavarapu &lt;five231003@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'cp/unit-test-reftable-record'</title>
<updated>2024-07-15T17:11:44Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-07-15T17:11:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9118e46e8175c25b505b1fd5b384c8931f027e17'/>
<id>urn:sha1:9118e46e8175c25b505b1fd5b384c8931f027e17</id>
<content type='text'>
A test in reftable library has been rewritten using the unit test
framework.

* cp/unit-test-reftable-record:
  t-reftable-record: add tests for reftable_log_record_compare_key()
  t-reftable-record: add tests for reftable_ref_record_compare_name()
  t-reftable-record: add index tests for reftable_record_is_deletion()
  t-reftable-record: add obj tests for reftable_record_is_deletion()
  t-reftable-record: add log tests for reftable_record_is_deletion()
  t-reftable-record: add ref tests for reftable_record_is_deletion()
  t-reftable-record: add comparison tests for obj records
  t-reftable-record: add comparison tests for index records
  t-reftable-record: add comparison tests for ref records
  t-reftable-record: add reftable_record_cmp() tests for log records
  t: move reftable/record_test.c to the unit testing framework
</content>
</entry>
<entry>
<title>Merge branch 'gt/unit-test-oidmap'</title>
<updated>2024-07-15T17:11:40Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-07-15T17:11:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cda729581bac4239716320bb382d963c1ab78a51'/>
<id>urn:sha1:cda729581bac4239716320bb382d963c1ab78a51</id>
<content type='text'>
An existing test of oidmap API has been rewritten with the
unit-test framework.

* gt/unit-test-oidmap:
  t: migrate helper/test-oidmap.c to unit-tests/t-oidmap.c
</content>
</entry>
<entry>
<title>t: migrate helper/test-oidmap.c to unit-tests/t-oidmap.c</title>
<updated>2024-07-03T16:12:14Z</updated>
<author>
<name>Ghanshyam Thakkar</name>
<email>shyamthakkar001@gmail.com</email>
</author>
<published>2024-07-03T06:29:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=28c1c077001d5cf715eb6264d75bc2537aa8cfd2'/>
<id>urn:sha1:28c1c077001d5cf715eb6264d75bc2537aa8cfd2</id>
<content type='text'>
helper/test-oidmap.c along with t0016-oidmap.sh test the oidmap.h
library which is built on top of hashmap.h.

Migrate them to the unit testing framework for better performance,
concise code and better debugging. Along with the migration also plug
memory leaks and make the test logic independent for all the tests.
The migration removes 'put' tests from t0016, because it is used as
setup to all the other tests, so testing it separately does not yield
any benefit.

Mentored-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Mentored-by: Kaartic Sivaraam &lt;kaartic.sivaraam@gmail.com&gt;
Reviewed-by: Josh Steadmon &lt;steadmon@google.com&gt;
Helped-by: Phillip Wood &lt;phillip.wood123@gmail.com&gt;
Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Ghanshyam Thakkar &lt;shyamthakkar001@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ps/use-the-repository'</title>
<updated>2024-07-02T16:59:00Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-07-02T16:59:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7b472da91541d672ee220896a3a7fd4508c378f3'/>
<id>urn:sha1:7b472da91541d672ee220896a3a7fd4508c378f3</id>
<content type='text'>
A CPP macro USE_THE_REPOSITORY_VARIABLE is introduced to help
transition the codebase to rely less on the availability of the
singleton the_repository instance.

* ps/use-the-repository:
  hex: guard declarations with `USE_THE_REPOSITORY_VARIABLE`
  t/helper: remove dependency on `the_repository` in "proc-receive"
  t/helper: fix segfault in "oid-array" command without repository
  t/helper: use correct object hash in partial-clone helper
  compat/fsmonitor: fix socket path in networked SHA256 repos
  replace-object: use hash algorithm from passed-in repository
  protocol-caps: use hash algorithm from passed-in repository
  oidset: pass hash algorithm when parsing file
  http-fetch: don't crash when parsing packfile without a repo
  hash-ll: merge with "hash.h"
  refs: avoid include cycle with "repository.h"
  global: introduce `USE_THE_REPOSITORY_VARIABLE` macro
  hash: require hash algorithm in `empty_tree_oid_hex()`
  hash: require hash algorithm in `is_empty_{blob,tree}_oid()`
  hash: make `is_null_oid()` independent of `the_repository`
  hash: convert `oidcmp()` and `oideq()` to compare whole hash
  global: ensure that object IDs are always padded
  hash: require hash algorithm in `oidread()` and `oidclr()`
  hash: require hash algorithm in `hasheq()`, `hashcmp()` and `hashclr()`
  hash: drop (mostly) unused `is_empty_{blob,tree}_sha1()` functions
</content>
</entry>
<entry>
<title>t-reftable-record: add tests for reftable_log_record_compare_key()</title>
<updated>2024-07-02T15:12:26Z</updated>
<author>
<name>Chandra Pratap</name>
<email>chandrapratap3519@gmail.com</email>
</author>
<published>2024-07-02T07:22:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b942fda6702994dc1a7ed91d33faceea68aedbc9'/>
<id>urn:sha1:b942fda6702994dc1a7ed91d33faceea68aedbc9</id>
<content type='text'>
reftable_log_record_compare_key() is a function defined by
reftable/record.{c, h} and is used to compare the keys of two
log records when sorting multiple log records using 'qsort'.
In the current testing setup, this function is left unexercised.
Add a testing function for the same.

Mentored-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Mentored-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Chandra Pratap &lt;chandrapratap3519@gmail.com&gt;
Acked-by: Karthik Nayak &lt;karthik.188@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t-reftable-record: add tests for reftable_ref_record_compare_name()</title>
<updated>2024-07-02T15:12:26Z</updated>
<author>
<name>Chandra Pratap</name>
<email>chandrapratap3519@gmail.com</email>
</author>
<published>2024-07-02T07:22:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f7ec13b53896966c233514c3906c284a40b00c3c'/>
<id>urn:sha1:f7ec13b53896966c233514c3906c284a40b00c3c</id>
<content type='text'>
reftable_ref_record_compare_name() is a function defined by
reftable/record.{c, h} and is used to compare the refname of two
ref records when sorting multiple ref records using 'qsort'.
In the current testing setup, this function is left unexercised.
Add a testing function for the same.

Mentored-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Mentored-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Chandra Pratap &lt;chandrapratap3519@gmail.com&gt;
Acked-by: Karthik Nayak &lt;karthik.188@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t-reftable-record: add index tests for reftable_record_is_deletion()</title>
<updated>2024-07-02T15:12:25Z</updated>
<author>
<name>Chandra Pratap</name>
<email>chandrapratap3519@gmail.com</email>
</author>
<published>2024-07-02T07:22:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8a1f1f88bbcac191d5904fd966e6a767caf97d4b'/>
<id>urn:sha1:8a1f1f88bbcac191d5904fd966e6a767caf97d4b</id>
<content type='text'>
reftable_record_is_deletion() is a function defined in
reftable/record.{c, h} that determines whether a record is of
type deletion or not. In the current testing setup, this function
is left untested for index records.

Add tests for this function in the case of index records.
Note that since index records cannot be of type deletion, this function
must always return '0' when called on an index record.

Mentored-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Mentored-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Chandra Pratap &lt;chandrapratap3519@gmail.com&gt;
Acked-by: Karthik Nayak &lt;karthik.188@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
