aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2017-03-30 20:13:46 +0200
committerDuncaen <mail@duncano.de>2017-03-30 20:29:01 +0200
commitfe58e376bc5ca12b54d58e329a3ec51062262827 (patch)
treed4f2652d836b57fb062655a6ec3279c7455b2117
parente7d9d3a92209b6c63cf3604a5c5af1524ff1ba38 (diff)
downloadmblaze-fe58e376bc5ca12b54d58e329a3ec51062262827.tar.gz
t: add mscan and msort tests
-rw-r--r--t/5000-mscan.t31
-rw-r--r--t/6000-msort.t88
2 files changed, 119 insertions, 0 deletions
diff --git a/t/5000-mscan.t b/t/5000-mscan.t
new file mode 100644
index 0000000..b25066b
--- /dev/null
+++ b/t/5000-mscan.t
@@ -0,0 +1,31 @@
+#!/bin/sh -e
+cd ${0%/*}
+. ./lib.sh
+plan 2
+
+rm -rf test.dir
+mkdir test.dir
+(
+cd test.dir
+
+mkdir -p "inbox/cur"
+
+cat <<! | mmime >"inbox/cur/1:2,"
+From: Rajwinder Kaur <rajwinder@example.com>
+Subject: Hello
+Date: Thu, 30 Mar 2017 15:42:05 +0200
+Message-Id: <EOH1F3NUOY.2KBVMHSBFATNY@example.org>
+
+body
+!
+
+cat <<! >seq
+inbox/cur/1:2,
+!
+
+export MAILSEQ=seq
+
+check_same 'ISO date' 'mscan -f "%16D" 1' 'echo "2017-03-30 15:42"'
+check_same 'from name' 'mscan -f "%f" 1' 'echo "Rajwinder Kaur"'
+
+)
diff --git a/t/6000-msort.t b/t/6000-msort.t
new file mode 100644
index 0000000..dd21cd0
--- /dev/null
+++ b/t/6000-msort.t
@@ -0,0 +1,88 @@
+#!/bin/sh -e
+cd ${0%/*}
+. ./lib.sh
+plan 5
+
+rm -rf test.dir
+mkdir test.dir
+(
+cd test.dir
+
+mkdir -p "inbox/cur"
+
+cat <<! | mmime >"inbox/cur/1:2,"
+From: Rajwinder Kaur <rajwinder@example.com>
+Subject: namaste
+Date: Thu, 30 Mar 2017 15:42:05 +0200
+Message-Id: <EOH1F3NUOY.2KBVMHSBFATNY@example.org>
+
+!
+
+cat <<! | mmime >"inbox/cur/2:2,"
+From: имярек <имярек@example.com>
+Subject: Здравствуйте
+Date: Thu, 30 Mar 2017 15:42:10 +0200
+Message-Id: <EOH8EKEA1Z.2YAIFN5KVCO6Z@example.org>
+
+!
+
+cat <<! | mmime >"inbox/cur/3:2,"
+From: Pera Perić <pera.p@example.com>
+Subject: Здраво
+Date: Thu, 30 Mar 2017 15:40:32 +0200
+Message-Id: <EOH8EEXVXF.32ZMPPCNGCJH5@example.org>
+
+!
+
+cat <<! | mmime >"inbox/cur/4:2,"
+From: Perico de los palotes <palotes@example.com>
+Subject: Hola
+Date: Thu, 30 Mar 2017 16:20:11 +0200
+Message-Id: <EOH8F4IA07.2FU96ZKHJEVFC@example.org>
+
+!
+
+cat <<! >seq
+inbox/cur/1:2,
+inbox/cur/2:2,
+inbox/cur/3:2,
+inbox/cur/4:2,
+!
+
+export MAILSEQ=seq
+
+check_same 'filename' 'msort -F' 'cat seq'
+
+cat <<! >expect
+inbox/cur/3:2,
+inbox/cur/1:2,
+inbox/cur/2:2,
+inbox/cur/4:2,
+!
+check_same 'date' 'msort -d' 'cat expect'
+
+cat <<! >expect
+inbox/cur/4:2,
+inbox/cur/2:2,
+inbox/cur/1:2,
+inbox/cur/3:2,
+!
+check_same 'reverse date' 'msort -dr' 'cat expect'
+
+cat <<! >expect
+inbox/cur/2:2,
+inbox/cur/3:2,
+inbox/cur/4:2,
+inbox/cur/1:2,
+!
+check_same 'from' 'msort -f' 'cat expect'
+
+cat <<! >expect
+inbox/cur/3:2,
+inbox/cur/2:2,
+inbox/cur/4:2,
+inbox/cur/1:2,
+!
+check_same 'subject' 'msort -s' 'cat expect'
+
+)