summaryrefslogtreecommitdiff
path: root/mh/tests/fmtfunc.at
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2017-07-01 02:11:16 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2017-07-01 02:18:21 +0300
commitc2e631e78f3259ff189f6cfc9e2c28b371aba361 (patch)
treec90c7ebde0b6a5504efe9380e175f5211f91e876 /mh/tests/fmtfunc.at
parent6b16ba1983922772ad47c5feec286e9c940de705 (diff)
downloadmailutils-c2e631e78f3259ff189f6cfc9e2c28b371aba361.tar.gz
mailutils-c2e631e78f3259ff189f6cfc9e2c28b371aba361.tar.bz2
More fixes in MH format parser
* mh/mh_fmtgram.y (codegen_node): Generate mhop_printlit instruction for fmtnode_print node with a literal or number argument. * mh/mh_format.c (mh_fvm_run): Handle mhop_printlit * mh/mh_format.h (mhop_printlit): New opcode. * mh/tests/fmtcomp.at: Update. * mh/tests/fmtfunc.at: Add more tests.
Diffstat (limited to 'mh/tests/fmtfunc.at')
-rw-r--r--mh/tests/fmtfunc.at70
1 files changed, 65 insertions, 5 deletions
diff --git a/mh/tests/fmtfunc.at b/mh/tests/fmtfunc.at
index 65107f3ed..a7d72bce5 100644
--- a/mh/tests/fmtfunc.at
+++ b/mh/tests/fmtfunc.at
@@ -84,14 +84,12 @@ FMTFUNC([void],
[])
FMTFUNC([strlen],
-[%(lit string)
-%(strlen)
+[%(lit string)=%(strlen)
],
[
],
-[string
-6
+[string=6
])
# FIXME: Not quite sure: perhaps it should report 80
@@ -221,7 +219,7 @@ AT_CHECK([MH_TEST=defined fmtcheck -form input.fmt -width 80 message
AT_CLEANUP
AT_SETUP([profile])
-AT_KEYWORDS([fmtfunc format])
+AT_KEYWORDS([fmtfunc format])xo
AT_DATA([input.fmt],[%(profile Local-Mailbox)
%(profile undefined)
%(profile moreproc)
@@ -308,6 +306,68 @@ X-Level: 8
[8
])
+# FIXME: This relies on LC_ALL=C
+FMTFUNC([decode],
+[%(decode{Subject})
+],
+[Subject: =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?= ... =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=
+
+body
+],
+[If you can read this yo ... u understand the example.
+])
+
+# FIXME: unquote
+
+FMTFUNC([trim],
+[%(void(lit trailing ))%(strlen)
+%(trim)%(strlen)
+],
+[
+
+],
+[12
+8
+])
+
+FMTFUNC([putstr],
+[%(void(lit string))%(putstr)
+%(putstr test)
+%(putstr{from})
+%(putstr(msg))
+],
+[From: foo@example.org
+
+],
+[string
+test
+foo@example.org
+1
+])
+
+# FIXME: putstrf
+
+FMTFUNC([putnum],
+[%(void(num 10))%(putnum)
+%(putnum 15)
+%(putnum{X-Number})
+%(putstr(msg))
+],
+[From: foo@example.org
+X-Number: 8
+
+body
+],
+[10
+15
+8
+1
+])
+
+# FIXME: putnumf
+
+# FIXME: putlit
+
m4_popdef([FMTFUNC]) \ No newline at end of file

Return to:

Send suggestions and report system problems to the System administrator.