{"thread":{"id":"51405","subject":"[PATCH 1/2] test-oidmap: remove 'add' subcommand","startedAt":"2019-06-29T07:58:06Z","lastAt":"2019-06-29T07:58:07Z","messageCount":2,"participants":["Christian Couder"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"378319","messageId":"20190629075747.32586-1-chriscool@tuxfamily.org","threadId":"51405","inReplyTo":null,"subject":"[PATCH 1/2] test-oidmap: remove 'add' subcommand","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2019-06-29T07:57:46Z","receivedAt":"2019-06-29T07:58:06Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"The 'add' subcommand is useless as it is mostly identical\nto the 'put' subcommand, so let's remove it.\n\nHelped-by: Derrick Stolee <stolee@gmail.com>\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n\nThis and 2/2 follow this discussion about test coverage:\n\nhttps://public-inbox.org/git/CAP8UFD3VFdCUwDBTb9en22FO7HnWc4vgQ4h0hhariCB=om4b8A@mail.gmail.com/\n\n t/helper/test-oidmap.c | 16 +---------------\n 1 file changed, 1 insertion(+), 15 deletions(-)\n\ndiff --git a/t/helper/test-oidmap.c b/t/helper/test-oidmap.c\nindex 7036588175..0acf99931e 100644\n--- a/t/helper/test-oidmap.c\n+++ b/t/helper/test-oidmap.c\n@@ -47,21 +47,7 @@ int cmd__oidmap(int argc, const char **argv)\n \t\tif (p1)\n \t\t\tp2 = strtok(NULL, DELIM);\n \n-\t\tif (!strcmp(\"add\", cmd) && p1 && p2) {\n-\n-\t\t\tif (get_oid(p1, &oid)) {\n-\t\t\t\tprintf(\"Unknown oid: %s\\n\", p1);\n-\t\t\t\tcontinue;\n-\t\t\t}\n-\n-\t\t\t/* create entry with oidkey from p1, value = p2 */\n-\t\t\tFLEX_ALLOC_STR(entry, name, p2);\n-\t\t\toidcpy(&entry->entry.oid, &oid);\n-\n-\t\t\t/* add to oidmap */\n-\t\t\toidmap_put(&map, entry);\n-\n-\t\t} else if (!strcmp(\"put\", cmd) && p1 && p2) {\n+\t\tif (!strcmp(\"put\", cmd) && p1 && p2) {\n \n \t\t\tif (get_oid(p1, &oid)) {\n \t\t\t\tprintf(\"Unknown oid: %s\\n\", p1);\n-- \n2.22.0.464.g81fc6c5d4a.dirty\n\n"},{"id":"378320","messageId":"20190629075747.32586-2-chriscool@tuxfamily.org","threadId":"51405","inReplyTo":"20190629075747.32586-1-chriscool@tuxfamily.org","subject":"[PATCH 2/2] t0016: add 'remove' subcommand test","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2019-06-29T07:57:47Z","receivedAt":"2019-06-29T07:58:07Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Testing the 'remove' subcommand was forgotten when t0016\nwas created. Let's fix that.\n\nHelped-by: Derrick Stolee <stolee@gmail.com>\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n t/t0016-oidmap.sh | 18 ++++++++++++++++++\n 1 file changed, 18 insertions(+)\n\ndiff --git a/t/t0016-oidmap.sh b/t/t0016-oidmap.sh\nindex af17264ce3..bbe719e950 100755\n--- a/t/t0016-oidmap.sh\n+++ b/t/t0016-oidmap.sh\n@@ -67,6 +67,24 @@ Unknown oid: invalidOid\n \n '\n \n+test_expect_success 'remove' '\n+\n+test_oidmap \"put one 1\n+put two 2\n+put three 3\n+remove one\n+remove two\n+remove invalidOid\n+remove four\" \"NULL\n+NULL\n+NULL\n+1\n+2\n+Unknown oid: invalidOid\n+NULL\"\n+\n+'\n+\n test_expect_success 'iterate' '\n \n test_oidmap \"put one 1\n-- \n2.22.0.464.g81fc6c5d4a.dirty\n\n"}]}