nmh-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nmh-commits] [SCM] The nmh Mail Handling System branch, master, updated


From: David Levine
Subject: [Nmh-commits] [SCM] The nmh Mail Handling System branch, master, updated. 67473e912ec0a0849a70cb61d9368c75dae614ee
Date: Sat, 18 Feb 2012 15:42:16 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The nmh Mail Handling System".

The branch, master has been updated
       via  67473e912ec0a0849a70cb61d9368c75dae614ee (commit)
      from  18b138a1003cf07114c2a4d03e4372e4e7bdc5f4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/nmh.git/commit/?id=67473e912ec0a0849a70cb61d9368c75dae614ee


commit 67473e912ec0a0849a70cb61d9368c75dae614ee
Author: David Levine <address@hidden>
Date:   Sat Feb 18 09:42:04 2012 -0600

    Added mhpath test.  Updated mhpath man page to reflect actual behavior for 
a message number greater than that of the highest existing message in a folder.

diff --git a/Makefile.am b/Makefile.am
index dc63866..7358c78 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -46,11 +46,13 @@ TESTS = test/bad-input/test-header test/folder/test-create \
        test/format/test-mymbox \
        test/inc/test-deb359167 test/inc/test-eom-align \
        test/manpages/test-manpages test/mhbuild/test-forw \
+       test/mhpath/test-mhpath \
        test/mhshow/test-cte-binary test/mhshow/test-qp \
        test/mhshow/test-subpart test/new/test-basic test/pick/test-stderr \
        test/repl/test-if-str test/scan/test-scan \
        test/whatnow/test-attach-detach test/whatnow/test-cd \
-       test/whatnow/test-ls test/cleanup
+       test/whatnow/test-ls \
+       test/cleanup ## The "cleanup" test should always be last.
 
 check_SCRIPTS = test/common.sh
 check_PROGRAMS = test/getfullname
diff --git a/man/mhpath.man b/man/mhpath.man
index e04c4a3..4ad442c 100644
--- a/man/mhpath.man
+++ b/man/mhpath.man
@@ -48,9 +48,14 @@ message, if the folder contains messages.
 .IP 3) 4
 An empty folder is not in itself an error.
 .PP
-Message numbers greater than the highest existing message in a folder
-as part of a range designation are replaced with the next free message
-number.
+A message number less than that of the smallest existing message in a
+folder is treated as if the message already exists.  A message number
+greater than that of the highest existing message in a folder causes
+an \*(lqout of range\*(rq error message to be displayed.
+.PP
+As part of a range designation that contains messages that do exist,
+message numbers less than the smallest, or greater than the highest,
+existing message in a folder are ignored.
 .PP
 Examples: The current folder foo contains messages 3 5 6.
 Cur is 4.
@@ -66,7 +71,7 @@ Cur is 4.
 /r/phyl/Mail/foo/6
 
 % mhpath 2001
-/r/phyl/Mail/foo/7
+mhpath: message 2001 out of range 1-6
 
 % mhpath 1\-2001
 /r/phyl/Mail/foo/3
@@ -81,13 +86,13 @@ Cur is 4.
 /r/phyl/Mail/foo/7
 
 % mhpath last\-new
-bad message list \*(lqlast\-new\*(rq.
+mhpath: bad message list last\-new
 
 % mhpath cur
 /r/phyl/Mail/foo/4
 
 % mhpath 1\-2
-no messages in range \*(lq1\-2\*(rq.
+mhpath: no messages in range 1\-2
 
 % mhpath first:2
 /r/phyl/Mail/foo/3
diff --git a/test/mhpath/test-mhpath b/test/mhpath/test-mhpath
new file mode 100755
index 0000000..2f88eb0
--- /dev/null
+++ b/test/mhpath/test-mhpath
@@ -0,0 +1,139 @@
+#!/bin/sh
+######################################################
+#
+# Test mhpath
+#
+######################################################
+
+set -e
+
+if test -z "${MH_OBJ_DIR}"; then
+    srcdir=`dirname $0`/../..
+    MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
+fi
+
+. "$MH_OBJ_DIR/test/common.sh"
+
+setup_test
+
+expected=$MH_TEST_DIR/$$.expected
+actual=$MH_TEST_DIR/$$.actual
+
+
+# check -help
+cat > $expected <<EOF
+Usage: mhpath [+folder] [msgs] [switches]
+  switches are:
+  -version
+  -help
+EOF
+# The exit status is 1 with -help, so invert it to prevent
+# triggering immediate exit due to set -e.
+! mhpath -help > $actual 2>&1
+check $expected $actual
+
+# check -version
+if ! mhpath -v | grep '^mhpath --' > /dev/null; then
+  echo "$0: mhpath -v generated unexpected output" 1>&2
+  failed=`expr ${failed:-0} + 1`
+fi
+
+# check +
+check_string "mhpath +" "$MH_TEST_DIR/Mail"
+
+# check with no options
+folder -fast +inbox > /dev/null
+check_string "mhpath" "$MH_TEST_DIR/Mail/inbox"
+
+# check +inbox
+check_string "mhpath +inbox" "$MH_TEST_DIR/Mail/inbox"
+
+# check all
+cat > $expected <<EOF
+$MH_TEST_DIR/Mail/inbox/1
+$MH_TEST_DIR/Mail/inbox/2
+$MH_TEST_DIR/Mail/inbox/3
+$MH_TEST_DIR/Mail/inbox/4
+$MH_TEST_DIR/Mail/inbox/5
+$MH_TEST_DIR/Mail/inbox/6
+$MH_TEST_DIR/Mail/inbox/7
+$MH_TEST_DIR/Mail/inbox/8
+$MH_TEST_DIR/Mail/inbox/9
+$MH_TEST_DIR/Mail/inbox/10
+EOF
+mhpath all > $actual 2>&1
+check $expected $actual
+
+# check message number greater than highest
+check_string "mhpath 11" "mhpath: message 11 out of range 1-10"
+check_string "mhpath 10 11" "mhpath: message 11 out of range 1-10"
+
+# check range with message number greater than highest
+cat > $expected <<EOF
+$MH_TEST_DIR/Mail/inbox/1
+$MH_TEST_DIR/Mail/inbox/2
+$MH_TEST_DIR/Mail/inbox/3
+$MH_TEST_DIR/Mail/inbox/4
+$MH_TEST_DIR/Mail/inbox/5
+$MH_TEST_DIR/Mail/inbox/6
+$MH_TEST_DIR/Mail/inbox/7
+$MH_TEST_DIR/Mail/inbox/8
+$MH_TEST_DIR/Mail/inbox/9
+$MH_TEST_DIR/Mail/inbox/10
+EOF
+mhpath 1-99999 > $actual 2>&1
+check $expected $actual
+
+# check new
+check_string "mhpath new" "$MH_TEST_DIR/Mail/inbox/11"
+
+# check multiple msgs, including new
+cat > $expected <<EOF
+$MH_TEST_DIR/Mail/inbox/1
+$MH_TEST_DIR/Mail/inbox/10
+$MH_TEST_DIR/Mail/inbox/11
+EOF
+mhpath first last new > $actual 2>&1
+check $expected $actual
+
+# check invalid message list using names
+check_string "mhpath last-new" "mhpath: bad message list last-new"
+
+# check cur
+folder +inbox 5 > /dev/null
+check_string "mhpath cur" "$MH_TEST_DIR/Mail/inbox/5"
+
+# check prev
+check_string "mhpath prev" "$MH_TEST_DIR/Mail/inbox/4"
+
+# check next
+check_string "mhpath next" "$MH_TEST_DIR/Mail/inbox/6"
+
+# check invalid message list using numbers
+rmm 1-2
+check_string "mhpath 1-2" "mhpath: no messages in range 1-2"
+
+# check ignoring of out-of-range message numbers in ranges
+check_string "mhpath 1-3" "$MH_TEST_DIR/Mail/inbox/3"
+check_string "mhpath first-3" "$MH_TEST_DIR/Mail/inbox/3"
+check_string "mhpath 10-11" "$MH_TEST_DIR/Mail/inbox/10"
+check_string "mhpath last-11" "$MH_TEST_DIR/Mail/inbox/10"
+
+# check reference to existing messages
+cat > $expected <<EOF
+$MH_TEST_DIR/Mail/inbox/3
+$MH_TEST_DIR/Mail/inbox/4
+EOF
+mhpath first:2 > $actual 2>&1
+check $expected $actual
+
+# check reference to non-existant messages
+cat > $expected <<EOF
+$MH_TEST_DIR/Mail/inbox/1
+$MH_TEST_DIR/Mail/inbox/2
+EOF
+mhpath 1 2 > $actual 2>&1
+check $expected $actual
+
+
+exit $failed

-----------------------------------------------------------------------

Summary of changes:
 Makefile.am             |    4 +-
 man/mhpath.man          |   17 ++++--
 test/mhpath/test-mhpath |  139 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 153 insertions(+), 7 deletions(-)
 create mode 100755 test/mhpath/test-mhpath


hooks/post-receive
-- 
The nmh Mail Handling System



reply via email to

[Prev in Thread] Current Thread [Next in Thread]