summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2017-07-04 17:04:37 +0300
committerSergey Poznyakoff <gray@gnu.org>2017-07-04 17:04:37 +0300
commit9dfd5bfbeb2af9142c11d4a0f9ed94ac44726268 (patch)
tree28fdde84f75c3cb6e1fb056aea3929713b3d8dc7
parent0603f581fc6048cabbb25a01ee912a77b0bac6d5 (diff)
downloadmailutils-9dfd5bfbeb2af9142c11d4a0f9ed94ac44726268.tar.gz
mailutils-9dfd5bfbeb2af9142c11d4a0f9ed94ac44726268.tar.bz2
Add more fmtfunc tests
-rw-r--r--mh/mh_format.c24
-rw-r--r--mh/tests/fmtfunc.at79
2 files changed, 98 insertions, 5 deletions
diff --git a/mh/mh_format.c b/mh/mh_format.c
index 1278bfa28..5b7607234 100644
--- a/mh/mh_format.c
+++ b/mh/mh_format.c
@@ -1306,8 +1306,21 @@ builtin_nodate (struct mh_fvm *mach)
1306static void 1306static void
1307builtin_proper (struct mh_fvm *mach) 1307builtin_proper (struct mh_fvm *mach)
1308{ 1308{
1309 /*FIXME: noop*/ 1309 int rc;
1310 builtin_str_noop (mach); 1310 char const *str;
1311 mu_address_t addr;
1312
1313 rc = mu_address_create (&addr, mh_string_value (&mach->str[R_ARG]));
1314 if (rc)
1315 {
1316 mh_string_copy (mach, R_REG, R_ARG);
1317 return;
1318 }
1319 if (mu_address_sget_printable (addr, &str) == 0)
1320 mh_string_load (&mach->str[R_REG], str);
1321 else
1322 mh_string_copy (mach, R_REG, R_ARG);
1323 mu_address_destroy (&addr);
1311} 1324}
1312 1325
1313/* friendly addr string user-friendly rendering*/ 1326/* friendly addr string user-friendly rendering*/
@@ -1323,9 +1336,10 @@ builtin_friendly (struct mh_fvm *mach)
1323 return; 1336 return;
1324 1337
1325 if (mu_address_sget_personal (addr, 1, &str) == 0 && str) 1338 if (mu_address_sget_personal (addr, 1, &str) == 0 && str)
1326 { 1339 mh_string_load (&mach->str[R_REG], str);
1327 mh_string_load (&mach->str[R_REG], str); 1340 else
1328 } 1341 mh_string_copy (mach, R_REG, R_ARG);
1342
1329 mu_address_destroy (&addr); 1343 mu_address_destroy (&addr);
1330} 1344}
1331 1345
diff --git a/mh/tests/fmtfunc.at b/mh/tests/fmtfunc.at
index e3793c49f..bb81f8a01 100644
--- a/mh/tests/fmtfunc.at
+++ b/mh/tests/fmtfunc.at
@@ -590,4 +590,83 @@ X-Date: Mon, 3 Jul 2017 13:17:58
590 590
591# FIXME: pretty 591# FIXME: pretty
592 592
593FMTFUNC([proper],
594[%(proper{From})
595],
596[From: Sergey <gray@gnu.org>
597
598text
599],
600[Sergey <gray@gnu.org>
601])
602
603FMTFUNC([friendly],
604[%(friendly{From})
605%(friendly{To})
606],
607[From: Sergey <gray@gnu.org>
608To: root@example.com
609
610text
611],
612[Sergey
613root@example.com
614])
615
616FMTFUNC([addr],
617[%(addr{From})
618%(addr{To})
619],
620[From: Sergey <gray@gnu.org>
621To: root@example.com
622
623text
624],
625[gray@gnu.org
626root@example.com
627])
628
629FMTFUNC([pers],
630[from=%(pers{From})
631to=%(pers{To})
632],
633[From: Sergey <gray@gnu.org>
634To: root@example.com
635
636text
637],
638[from=Sergey
639to=
640])
641
642# FIXME: note
643
644FMTFUNC([mbox],
645[%(mbox{From})
646],
647[From: Sergey <gray@gnu.org>
648
649],
650[gray
651])
652
653# FIXME: mymbox
654
655FMTFUNC([host],
656[%(host{From})
657],
658[From: Sergey <gray@gnu.org>
659
660],
661[gnu.org
662])
663
664# FIXME: nohost
665
666# FIXME: path
667
668# FIXME: ingrp
669
670# FIXME: gname
671
593m4_popdef([FMTFUNC]) \ No newline at end of file 672m4_popdef([FMTFUNC]) \ No newline at end of file

Return to:

Send suggestions and report system problems to the System administrator.