leahneukirchen / mblaze

Unix utilities to deal with Maildir
Other
441 stars 48 forks source link

seq: fix printing multiple mmsgs #181

Closed jeremybobbin closed 4 years ago

jeremybobbin commented 4 years ago

According to mseq(1), mseq should accept multiple msgs.

printf 'a\nb\n' | mseq -S
mseq 1 2

The above prints:

a
Duncaen commented 4 years ago

Maybe also add the following test case to your PR:

http://ix.io/2tSu

From 9c88276bd5b42f7c233f8ded07b5d5db54006349 Mon Sep 17 00:00:00 2001
From: Duncan Overbruck <mail@duncano.de>
Date: Tue, 11 Aug 2020 14:21:07 +0200
Subject: [PATCH] t/7000-mseq.t: add test case for multiple mmsg arguments

---
 t/7000-mseq.t | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/t/7000-mseq.t b/t/7000-mseq.t
index 4afa561..5566252 100644
--- a/t/7000-mseq.t
+++ b/t/7000-mseq.t
@@ -1,7 +1,7 @@
 #!/bin/sh -e
 cd ${0%/*}
 . ./lib.sh
-plan 10
+plan 11

 rm -rf test.dir
 mkdir test.dir
@@ -31,6 +31,7 @@ check_test 'whole thread' -eq 4 'mseq 6= | wc -l'
 check_test  'subthread' -eq 2 'mseq 7_ | wc -l'
 check 'parent' 'mseq 6^ | grep "inbox/cur/5_1:2,"'
 check_test 'range' -eq 3 'mseq 1:3 | wc -l'
+check_same 'multiple mmsg' 'mseq 1 2' 'echo "inbox/cur/1:2,\ninbox/cur/2:2,"'

 cat <<! >seq
 inbox/cur/1:2,
-- 
2.27.0
jeremybobbin commented 4 years ago

Thank you, @Duncaen !

leahneukirchen commented 4 years ago

You found a bug, but I fixed it at the call site. Thanks!