mhseq.at 6.87 KB
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2010, 2011 Free Software Foundation, Inc.
#
# GNU Mailutils is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3, or (at
# your option) any later version.
#
# GNU Mailutils is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.

m4_pushdef([MH_KEYWORDS],[mhseq mh-sequences])

dnl ---------------------------------------------------------------

MH_CHECK([mhseq: existing message number],[mhseq00],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
mhseq 1
],
[0],
[1
])

MH_CHECK([mhseq: not existing message number],[mhseq01],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
mhseq 100
],
[1],
[],
dnl FIXME: See FIXME 3 in mhpath.at
[mhseq: message 100 does not exist
])

MH_CHECK([mhseq: contiguous message range],[mhseq02],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
mhseq 2-5
],
[0],
[2
3
4
5
])

MH_CHECK([mhseq: reversed contiguous message range],[mhseq03],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
mhseq 5-2
],
[0],
[2
3
4
5
])

MH_CHECK([mhseq: reversed non-contiguous message range],[mhseq04],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/3 Mail/inbox/4
mhseq 5-2
],
[0],
[2
5
])

MH_CHECK([mhseq: message range (left fixup)],[mhseq05],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1 Mail/inbox/2
mhseq 1-5
],
[0],
[3
4
5
])

MH_CHECK([mhseq: message range (right fixup)],[mhseq06],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/4 Mail/inbox/5
mhseq 1-5
],
[0],
[1
2
3
])

MH_CHECK([mhseq: message range (both fixups)],[mhseq07],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1 Mail/inbox/5
mhseq 1-5
],
[0],
[2
3
4
])

MH_CHECK([mhseq: non-existent message range (left)],[mhseq08],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1 Mail/inbox/2 Mail/inbox/3
mhseq 1-2
],
[1],
[],
[mhseq: no messages in range 1-2
])

MH_CHECK([mhseq: non-existent message range (right)],[mhseq09],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
mhseq 6-10
],
[1],
[],
[mhseq: no messages in range 6-10
])

MH_CHECK([mhseq: message set addition],[mhseq10],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
mhseq 5 8-10 15-20
],
[0],
[5
8
9
10
15
16
17
18
19
20
])

MH_CHECK([mhseq: message set optimization],[mhseq11],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
rm Mail/inbox/17 Mail/inbox/19
mhseq 5 1-10 15-20
],
[0],
[1
2
3
4
5
6
7
8
9
10
15
16
18
20
])

MH_CHECK([mhseq: counted range (positive)],[mhseq12],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
mhseq 10:4
],
[0],
[10
11
12
13
])

MH_CHECK([mhseq: non-contiguous counted range (positive)],[mhseq13],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
rm Mail/inbox/12 Mail/inbox/14
mhseq 10:4
],
[0],
[10
11
13
15
])

MH_CHECK([mhseq: counted range (positive, left fixup)],[mhseq14],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1 Mail/inbox/2
mhseq 1:3
],
[0],
[3
4
5
])

MH_CHECK([mhseq: counted range (positive, right fixup)],[mhseq15],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
mhseq 2:10
],
[0],
[2
3
4
5
])

MH_CHECK([mhseq: invalid counted range (negative)],[mhseq16],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1 Mail/inbox/2
mhseq 10:2
],
[1],
[],
[mhseq: no messages in range 10:2
])

MH_CHECK([mhseq: counted range (negative)],[mhseq17],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
mhseq 10:-4
],
[0],
[7
8
9
10
])

MH_CHECK([mhseq: non-contiguous counted range (negative)],[mhseq18],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
rm Mail/inbox/8 Mail/inbox/6
mhseq 10:-4
],
[0],
[5
7
9
10
])

MH_CHECK([mhseq: counted range (negative, left fixup)],[mhseq19],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1 Mail/inbox/2
mhseq 4:-30
],
[0],
[3
4
])

MH_CHECK([mhseq: counted range (negative, right fixup)],[mhseq20],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1 Mail/inbox/2
mhseq 4:30
],
[0],
[4
5
])

MH_CHECK([mhseq: invalid counted range (negative)],[mhseq21],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1 Mail/inbox/2
mhseq 1:-30
],
[1],
[],
[mhseq: no messages in range 1:-30
])

MH_CHECK([mhseq: cur],[mhseq22 cur],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "cur: 3" > Mail/inbox/.mh_sequences
mhseq cur
],
[0],
[3
])

MH_CHECK([mhseq: cur:n -- default direction],[mhseq23 cur:n],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "cur: 3" > Mail/inbox/.mh_sequences
mhseq cur:2
],
[0],
[3
4
])

MH_CHECK([mhseq: cur:n -- explicit dir (negative)],[mhseq24 cur:n cur:n-],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "cur: 3" > Mail/inbox/.mh_sequences
mhseq cur:-2
],
[0],
[2
3
])

MH_CHECK([mhseq: cur:n -- explicit dir (positive)],[mhseq25 cur:n cur:n+],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "cur: 3" > Mail/inbox/.mh_sequences
mhseq cur:+2
],
[0],
[3
4
])

MH_CHECK([mhseq: next],[mhseq26 next],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "cur: 3" > Mail/inbox/.mh_sequences
rm Mail/inbox/4
mhseq next
],
[0],
[5
])

MH_CHECK([mhseq: next:n -- default direction],[mhseq27 next:n],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "cur: 3" > Mail/inbox/.mh_sequences
mhseq next:2
],
[0],
[4
5
])

MH_CHECK([mhseq: prev],[mhseq28 prev],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "cur: 3" > Mail/inbox/.mh_sequences
rm Mail/inbox/2
mhseq prev
],
[0],
[1
])

MH_CHECK([mhseq: prev:n -- default direction],[mhseq29 prev:n],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
echo "cur: 3" > Mail/inbox/.mh_sequences
mhseq prev:2
],
[0],
[1
2
])

MH_CHECK([mhseq: first],[mhseq30 first],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1
mhseq first
],
[0],
[2
])

MH_CHECK([mhseq: first:n -- default direction],[mhseq31 first:n],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
rm Mail/inbox/1
mhseq first:2
],
[0],
[2
3
])

MH_CHECK([mhseq: last],[mhseq32 last],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
mhseq last
],
[0],
[5
])

MH_CHECK([mhseq: last:n -- default direction],[mhseq33 last:n],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
mhseq last:2
],
[0],
[4
5
])

m4_popdef([MH_KEYWORDS])
# End of mhseq.at