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

2 messages from 2019-06-29 to 2019-06-29. Participants: Christian Couder.
Thread: https://gitlist.dev/t/51405

## Christian Couder, 2019-06-29 07:57

Subject: [PATCH 1/2] test-oidmap: remove 'add' subcommand
Message-ID: <20190629075747.32586-1-chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/20190629075747.32586-1-chriscool%40tuxfamily.org

```
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


```

## Christian Couder, 2019-06-29 07:57

Subject: [PATCH 2/2] t0016: add 'remove' subcommand test
Message-ID: <20190629075747.32586-2-chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/20190629075747.32586-2-chriscool%40tuxfamily.org
In-Reply-To: <20190629075747.32586-1-chriscool@tuxfamily.org>

```
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


```
