mblaze

Unix utilities to deal with Maildir - my mirror
git clone https://pi.duncano.de/git/mblaze.git
Log | Files | Refs | README | COPYING

commit fe58e376bc5ca12b54d58e329a3ec51062262827
parent e7d9d3a92209b6c63cf3604a5c5af1524ff1ba38
Author: Duncaen <mail@duncano.de>
Date:   Thu, 30 Mar 2017 20:13:46 +0200

t: add mscan and msort tests

Diffstat:
t/5000-mscan.t | 31+++++++++++++++++++++++++++++++
t/6000-msort.t | 88+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 119 insertions(+), 0 deletions(-)

diff --git a/t/5000-mscan.t 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 @@ -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' + +)