threads / patch / 51405

patch, 2 partstest-oidmap: remove 'add' subcommand

Subject: [PATCH 1/2] test-oidmap: remove 'add' subcommand

## tl;dr

2 messages between Jun 29, 2019 and Jun 29, 2019. Diffs are folded; open one to read it.

replies: 1people: 1as markdown or json

Christian Couder· Jun 29, 2019, 07:57 UTC · lore

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(-)
Show changes to t/helper/test-oidmap.c +1 −15
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
Christian Couder· Jun 29, 2019, 07:57 UTC · re: Christian Couder · lore

[PATCH 2/2] t0016: add 'remove' subcommand test

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(+)
Show changes to t/t0016-oidmap.sh +18 −0
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

← back to recent threads