aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2017-03-31 01:23:05 +0200
committerDuncaen <mail@duncano.de>2017-03-31 01:40:34 +0200
commit2287e896312613175f0c7f846d3a56cd9640ebde (patch)
tree27ed5a1348553166fb08777f5101d86f06485332
parent617e494ec0e9fc68d14dda1e626228b5b4f069d2 (diff)
downloadmblaze-2287e896312613175f0c7f846d3a56cd9640ebde.tar.gz
t: add mseq and mflag tests
-rw-r--r--t/7000-mseq.t35
-rw-r--r--t/8000-mflag.t35
2 files changed, 70 insertions, 0 deletions
diff --git a/t/7000-mseq.t b/t/7000-mseq.t
new file mode 100644
index 0000000..77eb596
--- /dev/null
+++ b/t/7000-mseq.t
@@ -0,0 +1,35 @@
+#!/bin/sh -e
+cd ${0%/*}
+. ./lib.sh
+plan 8
+
+rm -rf test.dir
+mkdir test.dir
+(
+cd test.dir
+
+cat <<! >seq
+inbox/cur/1:2,
+inbox/cur/2:2,
+inbox/cur/3:2,
+inbox/cur/4:2,
+inbox/cur/5_1:2,
+ inbox/cur/6_2:2,
+ inbox/cur/7_3:2,
+ inbox/cur/8_4:2,
+inbox/cur/9:2,
+inbox/cur/10:2,
+!
+
+export MAILCUR=cur MAILSEQ=seq
+
+check 'set current' 'mseq -C 1 && mseq . | grep "inbox/cur/1:2,"'
+check 'set next' 'mseq -C + && mseq . | grep "inbox/cur/2:2,"'
+check 'set prev' 'mseq -C - && mseq . | grep "inbox/cur/1:2,"'
+check 'last' 'mseq "$" | grep "inbox/cur/10:2,"'
+check 'whole thread' 'mseq 6= | wc -l | grep -qx 4'
+check 'subthread' 'mseq 7_ | wc -l | grep -qx 2'
+check 'parent' 'mseq 6^ | grep "inbox/cur/5_1:2,"'
+check 'range' 'mseq 1:3 | wc -l | grep -qx 3'
+
+)
diff --git a/t/8000-mflag.t b/t/8000-mflag.t
new file mode 100644
index 0000000..38ab639
--- /dev/null
+++ b/t/8000-mflag.t
@@ -0,0 +1,35 @@
+#!/bin/sh -e
+cd ${0%/*}
+. ./lib.sh
+plan 12
+
+rm -rf test.dir
+mkdir test.dir
+(
+cd test.dir
+
+cat <<! >seq
+inbox/cur/1:2,
+inbox/cur/2:2,
+!
+
+mkdir -p inbox/cur
+while read f; do touch "$f"; done <seq
+ln -sf inbox/cur/1:2, cur
+
+export MAILSEQ=seq MAILCUR=cur
+
+check 'mark seen' 'mflag -S 1 && [ -e "inbox/cur/1:2,S" ]'
+check 'fix seq' 'mseq -f | mseq -S | wc -l | grep -qx 2'
+check 'mark replied' 'mflag -R 1 && [ -e "inbox/cur/1:2,RS" ]'
+check 'fix seq' 'mseq -f | mseq -S | wc -l | grep -qx 2'
+check 'unmark replied' 'mflag -r 1 && [ -e "inbox/cur/1:2,S" ]'
+check 'fix seq' 'mseq -f | mseq -S | wc -l | grep -qx 2'
+check 'mark flagged' 'mflag -F 1 && [ -e "inbox/cur/1:2,FS" ]'
+check 'fix seq' 'mseq -f | mseq -S | wc -l | grep -qx 2'
+check 'unmark flagged' 'mflag -f 1 && [ -e "inbox/cur/1:2,S" ]'
+check 'fix seq' 'mseq -f | mseq -S | wc -l | grep -qx 2'
+check 'unmark seen' 'mflag -s 1 && [ -e "inbox/cur/1:2," ]'
+check 'fix seq' 'mseq -f | mseq -S | wc -l | grep -qx 2'
+
+)