git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 1/2] test-oidmap: remove 'add' subcommand
@ 2019-06-29  7:57 Christian Couder
  2019-06-29  7:57 ` [PATCH 2/2] t0016: add 'remove' subcommand test Christian Couder
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Couder @ 2019-06-29  7:57 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason,
	Jonathan Tan, SZEDER Gábor, Jeff King, Derrick Stolee,
	Christian Couder

The 'add' subcommand is useless as it is mostly identical
to the 'put' subcommand, so let's remove it.

Helped-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---

This and 2/2 follow this discussion about test coverage:

https://public-inbox.org/git/CAP8UFD3VFdCUwDBTb9en22FO7HnWc4vgQ4h0hhariCB=om4b8A@mail.gmail.com/

 t/helper/test-oidmap.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/t/helper/test-oidmap.c b/t/helper/test-oidmap.c
index 7036588175..0acf99931e 100644
--- a/t/helper/test-oidmap.c
+++ b/t/helper/test-oidmap.c
@@ -47,21 +47,7 @@ int cmd__oidmap(int argc, const char **argv)
 		if (p1)
 			p2 = strtok(NULL, DELIM);
 
-		if (!strcmp("add", cmd) && p1 && p2) {
-
-			if (get_oid(p1, &oid)) {
-				printf("Unknown oid: %s\n", p1);
-				continue;
-			}
-
-			/* create entry with oidkey from p1, value = p2 */
-			FLEX_ALLOC_STR(entry, name, p2);
-			oidcpy(&entry->entry.oid, &oid);
-
-			/* add to oidmap */
-			oidmap_put(&map, entry);
-
-		} else if (!strcmp("put", cmd) && p1 && p2) {
+		if (!strcmp("put", cmd) && p1 && p2) {
 
 			if (get_oid(p1, &oid)) {
 				printf("Unknown oid: %s\n", p1);
-- 
2.22.0.464.g81fc6c5d4a.dirty


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] t0016: add 'remove' subcommand test
  2019-06-29  7:57 [PATCH 1/2] test-oidmap: remove 'add' subcommand Christian Couder
@ 2019-06-29  7:57 ` Christian Couder
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Couder @ 2019-06-29  7:57 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason,
	Jonathan Tan, SZEDER Gábor, Jeff King, Derrick Stolee,
	Christian Couder

Testing the 'remove' subcommand was forgotten when t0016
was created. Let's fix that.

Helped-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 t/t0016-oidmap.sh | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/t/t0016-oidmap.sh b/t/t0016-oidmap.sh
index af17264ce3..bbe719e950 100755
--- a/t/t0016-oidmap.sh
+++ b/t/t0016-oidmap.sh
@@ -67,6 +67,24 @@ Unknown oid: invalidOid
 
 '
 
+test_expect_success 'remove' '
+
+test_oidmap "put one 1
+put two 2
+put three 3
+remove one
+remove two
+remove invalidOid
+remove four" "NULL
+NULL
+NULL
+1
+2
+Unknown oid: invalidOid
+NULL"
+
+'
+
 test_expect_success 'iterate' '
 
 test_oidmap "put one 1
-- 
2.22.0.464.g81fc6c5d4a.dirty


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-29  7:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-29  7:57 [PATCH 1/2] test-oidmap: remove 'add' subcommand Christian Couder
2019-06-29  7:57 ` [PATCH 2/2] t0016: add 'remove' subcommand test Christian Couder

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).