about summary refs log tree commit diff
path: root/t
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2017-03-30 18:02:20 +0200
committerDuncaen <mail@duncano.de>2017-03-30 20:29:01 +0200
commit0200d437d6f018338cc5a0b5ef1d21c20ffbc33a (patch)
tree56e714c8efbecbe646cc610bbb000da6a5b3fcdb /t
parent59900bed95548abf6556688ca31cb51773f0d7f5 (diff)
downloadmblaze-0200d437d6f018338cc5a0b5ef1d21c20ffbc33a.tar.gz
mblaze-0200d437d6f018338cc5a0b5ef1d21c20ffbc33a.tar.xz
mblaze-0200d437d6f018338cc5a0b5ef1d21c20ffbc33a.zip
t: add msed tests
Diffstat (limited to 't')
-rw-r--r--t/4000-msed.t35
1 files changed, 35 insertions, 0 deletions
diff --git a/t/4000-msed.t b/t/4000-msed.t
new file mode 100644
index 0000000..d4c8ff6
--- /dev/null
+++ b/t/4000-msed.t
@@ -0,0 +1,35 @@
+#!/bin/sh -e
+cd ${0%/*}
+. ./lib.sh
+plan 6
+
+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 'append new' 'msed "/foobar/a/value/" 1 | grep "Foobar: value"'
+check 'append existing' 'msed "/subject/a/world/" 1 | grep -v "world"'
+check 'append multiple' 'msed "/foo/a/catch/;/bar/a/catch/" 1 | grep -c catch | grep -qx 2'
+check 'change' 'msed "/subject/c/world/" 1 | grep "Subject: world"'
+check 'delete' 'msed "/message-id/d" 1 | grep -v "Message-Id"'
+check 'substitute' 'msed "/subject/s/\(Hello\)/\1 World/" 1 | grep "^Subject: Hello World$"'
+
+)