From 61ad405b4ad88acf3f2e495c3fedcc9588e8ab36 Mon Sep 17 00:00:00 2001 From: Dianne Skoll Date: Wed, 27 May 2015 13:19:25 -0400 Subject: [PATCH] Reject AT clause with more than one following TIME. --- src/dorem.c | 1 + src/err.h | 5 +- src/langs/finnish.h | 9 +- src/langs/french.h | 6 +- src/langs/polish.h | 6 +- src/langs/portbr.h | 3 +- tests/test.cmp | 268 ++++++++++++++++++++++---------------------- tests/test.rem | 3 + 8 files changed, 159 insertions(+), 142 deletions(-) diff --git a/src/dorem.c b/src/dorem.c index 65ed10d1..c7fb3ee7 100644 --- a/src/dorem.c +++ b/src/dorem.c @@ -447,6 +447,7 @@ static int ParseTimeTrig(ParsePtr s, TimeTrig *tim, int save_in_globals) switch(tok.type) { case T_Time: DBufFree(&buf); + if (tim->ttime != NO_TIME) return E_TIME_TWICE; tim->ttime = tok.val; break; diff --git a/src/err.h b/src/err.h index 2051d545..f1a5fc75 100644 --- a/src/err.h +++ b/src/err.h @@ -119,7 +119,7 @@ #define E_CANT_CONVERT_TZ 99 #define E_NO_MATCHING_REMS 100 #define E_STRING_TOO_LONG 101 - +#define E_TIME_TWICE 102 #ifdef MK_GLOBALS #undef EXTERN #define EXTERN @@ -234,7 +234,8 @@ EXTERN char *ErrMsg[] "Bad function in WARN clause", "Can't convert between time zones", "No files matching *.rem", - "String too long" + "String too long", + "Time specified twice" } #endif /* MK_GLOBALS */ ; diff --git a/src/langs/finnish.h b/src/langs/finnish.h index 2e321df5..565df45b 100644 --- a/src/langs/finnish.h +++ b/src/langs/finnish.h @@ -302,7 +302,8 @@ EXTERN char *ErrMsg[] = "Virheellinen funktio WARN-lausekkeessa", "Can't convert between time zones", "No files matching *.rem", - "String too long" + "String too long", + "Time specified twice" #elif IBMEXTENDED "Ok", @@ -406,7 +407,8 @@ EXTERN char *ErrMsg[] = "Virheellinen funktio WARN-lausekkeessa", "Can't convert between time zones", "No files matching *.rem", - "String too long" + "String too long", + "Time specified twice" #else "Ok", @@ -510,7 +512,8 @@ EXTERN char *ErrMsg[] = "Virheellinen funktio WARN-lausekkeessa", "Can't convert between time zones", "No files matching *.rem", - "String too long" + "String too long", + "Time specified twice" #endif diff --git a/src/langs/french.h b/src/langs/french.h index 4e835ae0..ba72c070 100644 --- a/src/langs/french.h +++ b/src/langs/french.h @@ -242,7 +242,8 @@ EXTERN char *ErrMsg[] = "Fonction ill\351gale apr\350s WARN", "Can't convert between time zones", "No files matching *.rem", - "String too long" + "String too long", + "Time specified twice" #else /* ISOLATIN1 */ "Ok", @@ -346,7 +347,8 @@ EXTERN char *ErrMsg[] = "Fonction illegale apres WARN", "Can't convert between time zones", "No files matching *.rem", - "String too long" + "String too long", + "Time specified twice" #endif /* ISOLATIN1 */ }; #endif /* MK_GLOBALS */ diff --git a/src/langs/polish.h b/src/langs/polish.h index b75ed158..09888fa6 100644 --- a/src/langs/polish.h +++ b/src/langs/polish.h @@ -281,7 +281,8 @@ EXTERN char *ErrMsg[] = "Illegal function in WARN clause (NEEDS TRANSLATION TO POLISH)", "Can't convert between time zones", "No files matching *.rem", - "String too long" + "String too long", + "Time specified twice" #else /* ISOLATIN1 */ "OK", "Brakujacy ']'", @@ -384,7 +385,8 @@ EXTERN char *ErrMsg[] = "Illegal function in WARN clause (NEEDS TRANSLATION TO POLISH)", "Can't convert between time zones", "No files matching *.rem", - "String too long" + "String too long", + "Time specified twice" #endif /* ISOLATIN1 */ }; #endif /* MK_GLOBALS */ diff --git a/src/langs/portbr.h b/src/langs/portbr.h index e5963106..5c542e8c 100644 --- a/src/langs/portbr.h +++ b/src/langs/portbr.h @@ -247,7 +247,8 @@ EXTERN char *ErrMsg[] = "Funcao ilegal na clausula WARN", "Can't convert between time zones", "No files matching *.rem", - "String too long" + "String too long", + "Time specified twice" }; #endif /* MK_GLOBALS */ diff --git a/tests/test.cmp b/tests/test.cmp index 7cabe7b6..68e0a20a 100644 --- a/tests/test.cmp +++ b/tests/test.cmp @@ -12,8 +12,12 @@ Test 1 REM Wed UNTIL 15 Feb 1991 SATISFY [trigdate() > '1990-01-01'] MSG wookie ../tests/test.rem(10): Expired +# bad AT +REM AT 0:00 0:01 0:02 MSG foo +../tests/test.rem(13): Time specified twice + REM MSG Today is [hebday(today())] [hebmon(today())] [hebyear(today())] -../tests/test.rem(12): Trig = Saturday, 16 February, 1991 +../tests/test.rem(15): Trig = Saturday, 16 February, 1991 Reminders for Saturday, 16th February, 1991: today() => 1991-02-16 @@ -33,7 +37,7 @@ y => "Tishrey" hebdate(1, "Tishrey") => 1991-09-09 trigger(1991-09-09) => "9 September 1991" Leaving UserFN _h() => "9 September 1991" -../tests/test.rem(15): Trig = Monday, 9 September, 1991 +../tests/test.rem(18): Trig = Monday, 9 September, 1991 [_h(2, "Tishrey")] MSG Rosh Hashana 2 Entering UserFN _h(2, "Tishrey") x => 2 @@ -41,7 +45,7 @@ y => "Tishrey" hebdate(2, "Tishrey") => 1991-09-10 trigger(1991-09-10) => "10 September 1991" Leaving UserFN _h() => "10 September 1991" -../tests/test.rem(16): Trig = Tuesday, 10 September, 1991 +../tests/test.rem(19): Trig = Tuesday, 10 September, 1991 [_h(3, "Tishrey")] MSG Tzom Gedalia Entering UserFN _h(3, "Tishrey") x => 3 @@ -49,7 +53,7 @@ y => "Tishrey" hebdate(3, "Tishrey") => 1991-09-11 trigger(1991-09-11) => "11 September 1991" Leaving UserFN _h() => "11 September 1991" -../tests/test.rem(17): Trig = Wednesday, 11 September, 1991 +../tests/test.rem(20): Trig = Wednesday, 11 September, 1991 [_h(10, "Tishrey")] MSG Yom Kippur Entering UserFN _h(10, "Tishrey") x => 10 @@ -57,7 +61,7 @@ y => "Tishrey" hebdate(10, "Tishrey") => 1991-09-18 trigger(1991-09-18) => "18 September 1991" Leaving UserFN _h() => "18 September 1991" -../tests/test.rem(18): Trig = Wednesday, 18 September, 1991 +../tests/test.rem(21): Trig = Wednesday, 18 September, 1991 [_h(15, "Tishrey")] MSG Sukkot 1 Entering UserFN _h(15, "Tishrey") x => 15 @@ -65,7 +69,7 @@ y => "Tishrey" hebdate(15, "Tishrey") => 1991-09-23 trigger(1991-09-23) => "23 September 1991" Leaving UserFN _h() => "23 September 1991" -../tests/test.rem(19): Trig = Monday, 23 September, 1991 +../tests/test.rem(22): Trig = Monday, 23 September, 1991 [_h(25, "Kislev")] MSG Channuka Entering UserFN _h(25, "Kislev") x => 25 @@ -73,7 +77,7 @@ y => "Kislev" hebdate(25, "Kislev") => 1991-12-02 trigger(1991-12-02) => "2 December 1991" Leaving UserFN _h() => "2 December 1991" -../tests/test.rem(20): Trig = Monday, 2 December, 1991 +../tests/test.rem(23): Trig = Monday, 2 December, 1991 [_h(10, "Tevet")] MSG Asara B'Tevet Entering UserFN _h(10, "Tevet") x => 10 @@ -81,7 +85,7 @@ y => "Tevet" hebdate(10, "Tevet") => 1991-12-17 trigger(1991-12-17) => "17 December 1991" Leaving UserFN _h() => "17 December 1991" -../tests/test.rem(21): Trig = Tuesday, 17 December, 1991 +../tests/test.rem(24): Trig = Tuesday, 17 December, 1991 [_h(15, "Shvat")] MSG Tu B'Shvat Entering UserFN _h(15, "Shvat") x => 15 @@ -89,7 +93,7 @@ y => "Shvat" hebdate(15, "Shvat") => 1992-01-20 trigger(1992-01-20) => "20 January 1992" Leaving UserFN _h() => "20 January 1992" -../tests/test.rem(22): Trig = Monday, 20 January, 1992 +../tests/test.rem(25): Trig = Monday, 20 January, 1992 [_h(15, "Adar A")] MSG Purim Katan Entering UserFN _h(15, "Adar A") x => 15 @@ -97,7 +101,7 @@ y => "Adar A" hebdate(15, "Adar A") => 1992-02-19 trigger(1992-02-19) => "19 February 1992" Leaving UserFN _h() => "19 February 1992" -../tests/test.rem(23): Trig = Wednesday, 19 February, 1992 +../tests/test.rem(26): Trig = Wednesday, 19 February, 1992 [_h(14, "Adar")] MSG Purim Entering UserFN _h(14, "Adar") x => 14 @@ -105,7 +109,7 @@ y => "Adar" hebdate(14, "Adar") => 1991-02-28 trigger(1991-02-28) => "28 February 1991" Leaving UserFN _h() => "28 February 1991" -../tests/test.rem(24): Trig = Thursday, 28 February, 1991 +../tests/test.rem(27): Trig = Thursday, 28 February, 1991 [_h(15, "Nisan")] MSG Pesach Entering UserFN _h(15, "Nisan") x => 15 @@ -113,7 +117,7 @@ y => "Nisan" hebdate(15, "Nisan") => 1991-03-30 trigger(1991-03-30) => "30 March 1991" Leaving UserFN _h() => "30 March 1991" -../tests/test.rem(25): Trig = Saturday, 30 March, 1991 +../tests/test.rem(28): Trig = Saturday, 30 March, 1991 [_h(27, "Nisan")] MSG Yom HaShoah Entering UserFN _h(27, "Nisan") x => 27 @@ -121,7 +125,7 @@ y => "Nisan" hebdate(27, "Nisan") => 1991-04-11 trigger(1991-04-11) => "11 April 1991" Leaving UserFN _h() => "11 April 1991" -../tests/test.rem(26): Trig = Thursday, 11 April, 1991 +../tests/test.rem(29): Trig = Thursday, 11 April, 1991 [_h(4, "Iyar")] MSG Yom HaZikaron Entering UserFN _h(4, "Iyar") x => 4 @@ -129,7 +133,7 @@ y => "Iyar" hebdate(4, "Iyar") => 1991-04-18 trigger(1991-04-18) => "18 April 1991" Leaving UserFN _h() => "18 April 1991" -../tests/test.rem(27): Trig = Thursday, 18 April, 1991 +../tests/test.rem(30): Trig = Thursday, 18 April, 1991 [_h(5, "Iyar")] MSG Yom Ha'atzmaut Entering UserFN _h(5, "Iyar") x => 5 @@ -137,7 +141,7 @@ y => "Iyar" hebdate(5, "Iyar") => 1991-04-19 trigger(1991-04-19) => "19 April 1991" Leaving UserFN _h() => "19 April 1991" -../tests/test.rem(28): Trig = Friday, 19 April, 1991 +../tests/test.rem(31): Trig = Friday, 19 April, 1991 [_h(28, "Iyar")] MSG Yom Yerushalayim Entering UserFN _h(28, "Iyar") x => 28 @@ -145,7 +149,7 @@ y => "Iyar" hebdate(28, "Iyar") => 1991-05-12 trigger(1991-05-12) => "12 May 1991" Leaving UserFN _h() => "12 May 1991" -../tests/test.rem(29): Trig = Sunday, 12 May, 1991 +../tests/test.rem(32): Trig = Sunday, 12 May, 1991 [_h(6, "Sivan")] MSG Shavuot Entering UserFN _h(6, "Sivan") x => 6 @@ -153,7 +157,7 @@ y => "Sivan" hebdate(6, "Sivan") => 1991-05-19 trigger(1991-05-19) => "19 May 1991" Leaving UserFN _h() => "19 May 1991" -../tests/test.rem(30): Trig = Sunday, 19 May, 1991 +../tests/test.rem(33): Trig = Sunday, 19 May, 1991 [_h(9, "Av")] MSG Tish'a B'Av Entering UserFN _h(9, "Av") x => 9 @@ -161,7 +165,7 @@ y => "Av" hebdate(9, "Av") => 1991-07-20 trigger(1991-07-20) => "20 July 1991" Leaving UserFN _h() => "20 July 1991" -../tests/test.rem(31): Trig = Saturday, 20 July, 1991 +../tests/test.rem(34): Trig = Saturday, 20 July, 1991 # Test some jahrzeit cases fset _i(x,y,z,a) trigger(hebdate(x,y,z,a)) @@ -175,7 +179,7 @@ a => 5759 hebdate(30, "Heshvan", 1991-02-16, 5759) => 1991-11-07 trigger(1991-11-07) => "7 November 1991" Leaving UserFN _i() => "7 November 1991" -../tests/test.rem(35): Trig = Thursday, 7 November, 1991 +../tests/test.rem(38): Trig = Thursday, 7 November, 1991 [_i(30, "Heshvan", today(), 5760)] MSG Complete-Defective today() => 1991-02-16 Entering UserFN _i(30, "Heshvan", 1991-02-16, 5760) @@ -186,7 +190,7 @@ a => 5760 hebdate(30, "Heshvan", 1991-02-16, 5760) => 1991-11-07 trigger(1991-11-07) => "7 November 1991" Leaving UserFN _i() => "7 November 1991" -../tests/test.rem(36): Trig = Thursday, 7 November, 1991 +../tests/test.rem(39): Trig = Thursday, 7 November, 1991 [_i(30, "Heshvan", today(), 5761)] MSG Illegal today() => 1991-02-16 Entering UserFN _i(30, "Heshvan", 1991-02-16, 5761) @@ -194,7 +198,7 @@ x => 30 y => "Heshvan" z => 1991-02-16 a => 5761 -hebdate(30, "Heshvan", 1991-02-16, 5761) => ../tests/test.rem(37): 30 Heshvan 5761: Invalid Hebrew date +hebdate(30, "Heshvan", 1991-02-16, 5761) => ../tests/test.rem(40): 30 Heshvan 5761: Invalid Hebrew date Invalid Hebrew date Leaving UserFN _i() => Invalid Hebrew date @@ -208,7 +212,7 @@ a => 5759 hebdate(30, "Kislev", 1991-02-16, 5759) => 1991-12-07 trigger(1991-12-07) => "7 December 1991" Leaving UserFN _i() => "7 December 1991" -../tests/test.rem(39): Trig = Saturday, 7 December, 1991 +../tests/test.rem(42): Trig = Saturday, 7 December, 1991 [_i(30, "Kislev", today(), 5760)] MSG Complete-Defective today() => 1991-02-16 Entering UserFN _i(30, "Kislev", 1991-02-16, 5760) @@ -219,7 +223,7 @@ a => 5760 hebdate(30, "Kislev", 1991-02-16, 5760) => 1991-12-07 trigger(1991-12-07) => "7 December 1991" Leaving UserFN _i() => "7 December 1991" -../tests/test.rem(40): Trig = Saturday, 7 December, 1991 +../tests/test.rem(43): Trig = Saturday, 7 December, 1991 [_i(30, "Kislev", today(), 5761)] MSG Illegal today() => 1991-02-16 Entering UserFN _i(30, "Kislev", 1991-02-16, 5761) @@ -227,7 +231,7 @@ x => 30 y => "Kislev" z => 1991-02-16 a => 5761 -hebdate(30, "Kislev", 1991-02-16, 5761) => ../tests/test.rem(41): 30 Kislev 5761: Invalid Hebrew date +hebdate(30, "Kislev", 1991-02-16, 5761) => ../tests/test.rem(44): 30 Kislev 5761: Invalid Hebrew date Invalid Hebrew date Leaving UserFN _i() => Invalid Hebrew date @@ -241,7 +245,7 @@ a => 5755 hebdate(30, "Adar A", 1991-02-16, 5755) => 1992-03-05 trigger(1992-03-05) => "5 March 1992" Leaving UserFN _i() => "5 March 1992" -../tests/test.rem(43): Trig = Thursday, 5 March, 1992 +../tests/test.rem(46): Trig = Thursday, 5 March, 1992 [_i(30, "Adar A", today(), 5756)] MSG Illegal today() => 1991-02-16 Entering UserFN _i(30, "Adar A", 1991-02-16, 5756) @@ -249,7 +253,7 @@ x => 30 y => "Adar A" z => 1991-02-16 a => 5756 -hebdate(30, "Adar A", 1991-02-16, 5756) => ../tests/test.rem(44): No Adar A in 5756 +hebdate(30, "Adar A", 1991-02-16, 5756) => ../tests/test.rem(47): No Adar A in 5756 Invalid Hebrew date Leaving UserFN _i() => Invalid Hebrew date [_i(29, "Adar A", today(), 5755)] MSG Leap @@ -262,7 +266,7 @@ a => 5755 hebdate(29, "Adar A", 1991-02-16, 5755) => 1991-03-15 trigger(1991-03-15) => "15 March 1991" Leaving UserFN _i() => "15 March 1991" -../tests/test.rem(45): Trig = Friday, 15 March, 1991 +../tests/test.rem(48): Trig = Friday, 15 March, 1991 [_i(29, "Adar A", today(), 5756)] MSG Illegal today() => 1991-02-16 Entering UserFN _i(29, "Adar A", 1991-02-16, 5756) @@ -270,225 +274,225 @@ x => 29 y => "Adar A" z => 1991-02-16 a => 5756 -hebdate(29, "Adar A", 1991-02-16, 5756) => ../tests/test.rem(46): No Adar A in 5756 +hebdate(29, "Adar A", 1991-02-16, 5756) => ../tests/test.rem(49): No Adar A in 5756 Invalid Hebrew date Leaving UserFN _i() => Invalid Hebrew date # This causes a parse error on version 03.01.01 REM 1990-01-01 SATISFY 1 -../tests/test.rem(49): Expired +../tests/test.rem(52): Expired # Test each possible case of the basic reminders. REM MSG Every Day -../tests/test.rem(53): Trig = Saturday, 16 February, 1991 +../tests/test.rem(56): Trig = Saturday, 16 February, 1991 Every Day REM 18 MSG Every 18th -../tests/test.rem(55): Trig = Monday, 18 February, 1991 +../tests/test.rem(58): Trig = Monday, 18 February, 1991 REM 15 MSG Every 15th -../tests/test.rem(56): Trig = Friday, 15 March, 1991 +../tests/test.rem(59): Trig = Friday, 15 March, 1991 REM Feb MSG February -../tests/test.rem(58): Trig = Saturday, 16 February, 1991 +../tests/test.rem(61): Trig = Saturday, 16 February, 1991 February REM Jan MSG January -../tests/test.rem(59): Trig = Wednesday, 1 January, 1992 +../tests/test.rem(62): Trig = Wednesday, 1 January, 1992 REM March MSG March -../tests/test.rem(60): Trig = Friday, 1 March, 1991 +../tests/test.rem(63): Trig = Friday, 1 March, 1991 REM 13 Jan MSG 13 Jan -../tests/test.rem(62): Trig = Monday, 13 January, 1992 +../tests/test.rem(65): Trig = Monday, 13 January, 1992 REM 15 Feb MSG 15 Feb -../tests/test.rem(63): Trig = Saturday, 15 February, 1992 +../tests/test.rem(66): Trig = Saturday, 15 February, 1992 REM 28 Feb MSG 28 Feb -../tests/test.rem(64): Trig = Thursday, 28 February, 1991 +../tests/test.rem(67): Trig = Thursday, 28 February, 1991 REM 29 Feb MSG 29 Feb -../tests/test.rem(65): Trig = Saturday, 29 February, 1992 +../tests/test.rem(68): Trig = Saturday, 29 February, 1992 REM 5 Mar MSG 5 Mar -../tests/test.rem(66): Trig = Tuesday, 5 March, 1991 +../tests/test.rem(69): Trig = Tuesday, 5 March, 1991 REM 1990 MSG 1990 -../tests/test.rem(68): Expired +../tests/test.rem(71): Expired REM 1991 MSG 1991 -../tests/test.rem(69): Trig = Saturday, 16 February, 1991 +../tests/test.rem(72): Trig = Saturday, 16 February, 1991 1991 REM 1992 MSG 1991 -../tests/test.rem(70): Trig = Wednesday, 1 January, 1992 +../tests/test.rem(73): Trig = Wednesday, 1 January, 1992 REM 1 1990 MSG 1 1990 -../tests/test.rem(72): Expired +../tests/test.rem(75): Expired REM 29 1991 MSG 29 1991 -../tests/test.rem(73): Trig = Friday, 29 March, 1991 +../tests/test.rem(76): Trig = Friday, 29 March, 1991 REM 29 1992 MSG 29 1992 -../tests/test.rem(74): Trig = Wednesday, 29 January, 1992 +../tests/test.rem(77): Trig = Wednesday, 29 January, 1992 REM 16 1991 MSG 16 1991 -../tests/test.rem(75): Trig = Saturday, 16 February, 1991 +../tests/test.rem(78): Trig = Saturday, 16 February, 1991 16 1991 REM Jan 1990 MSG Jan 1990 -../tests/test.rem(77): Expired +../tests/test.rem(80): Expired REM Feb 1991 MSG Feb 1991 -../tests/test.rem(78): Trig = Saturday, 16 February, 1991 +../tests/test.rem(81): Trig = Saturday, 16 February, 1991 Feb 1991 REM Dec 1991 MSG Dec 1991 -../tests/test.rem(79): Trig = Sunday, 1 December, 1991 +../tests/test.rem(82): Trig = Sunday, 1 December, 1991 REM May 1992 MSG May 1992 -../tests/test.rem(80): Trig = Friday, 1 May, 1992 +../tests/test.rem(83): Trig = Friday, 1 May, 1992 REM 1 Jan 1991 MSG 1 Jan 1991 -../tests/test.rem(82): Expired +../tests/test.rem(85): Expired REM 16 Feb 1991 MSG 16 Feb 1991 -../tests/test.rem(83): Trig = Saturday, 16 February, 1991 +../tests/test.rem(86): Trig = Saturday, 16 February, 1991 16 Feb 1991 REM 29 Dec 1992 MSG 29 Dec 1992 -../tests/test.rem(84): Trig = Tuesday, 29 December, 1992 +../tests/test.rem(87): Trig = Tuesday, 29 December, 1992 REM Sun MSG Sun -../tests/test.rem(86): Trig = Sunday, 17 February, 1991 +../tests/test.rem(89): Trig = Sunday, 17 February, 1991 REM Fri Sat Tue MSG Fri Sat Tue -../tests/test.rem(87): Trig = Saturday, 16 February, 1991 +../tests/test.rem(90): Trig = Saturday, 16 February, 1991 Fri Sat Tue REM Sun 16 MSG Sun 16 -../tests/test.rem(89): Trig = Sunday, 17 February, 1991 +../tests/test.rem(92): Trig = Sunday, 17 February, 1991 REM Mon Tue Wed Thu Fri 1 MSG Mon Tue Wed Thu Fri 1 -../tests/test.rem(90): Trig = Friday, 1 March, 1991 +../tests/test.rem(93): Trig = Friday, 1 March, 1991 REM Sun Feb MSG Sun Feb -../tests/test.rem(92): Trig = Sunday, 17 February, 1991 +../tests/test.rem(95): Trig = Sunday, 17 February, 1991 REM Mon Tue March MSG Mon Tue March -../tests/test.rem(93): Trig = Monday, 4 March, 1991 +../tests/test.rem(96): Trig = Monday, 4 March, 1991 REM Sun 16 Feb MSG Sun 16 Feb -../tests/test.rem(95): Trig = Sunday, 17 February, 1991 +../tests/test.rem(98): Trig = Sunday, 17 February, 1991 REM Mon Tue 10 March MSG Mon Tue 10 March -../tests/test.rem(96): Trig = Monday, 11 March, 1991 +../tests/test.rem(99): Trig = Monday, 11 March, 1991 REM Sat Sun 1991 MSG Sat Sun 1991 -../tests/test.rem(98): Trig = Saturday, 16 February, 1991 +../tests/test.rem(101): Trig = Saturday, 16 February, 1991 Sat Sun 1991 REM Mon Tue 1992 MSG Mon Tue 1992 -../tests/test.rem(99): Trig = Monday, 6 January, 1992 +../tests/test.rem(102): Trig = Monday, 6 January, 1992 REM Sun 16 1991 MSG Sun 16 1991 -../tests/test.rem(101): Trig = Sunday, 17 February, 1991 +../tests/test.rem(104): Trig = Sunday, 17 February, 1991 REM Mon Tue Wed Thu Fri 1 1992 MSG Mon Tue Wed Thu Fri 1 1992 -../tests/test.rem(102): Trig = Wednesday, 1 January, 1992 +../tests/test.rem(105): Trig = Wednesday, 1 January, 1992 REM Mon Feb 1991 MSG Mon Feb 1991 -../tests/test.rem(104): Trig = Monday, 18 February, 1991 +../tests/test.rem(107): Trig = Monday, 18 February, 1991 REM Tue Jan 1992 MSG Tue Jan 1992 -../tests/test.rem(105): Trig = Tuesday, 7 January, 1992 +../tests/test.rem(108): Trig = Tuesday, 7 January, 1992 REM Sun Mon 16 Feb 1991 MSG Sun Mon 16 Feb 1991 -../tests/test.rem(107): Trig = Sunday, 17 February, 1991 +../tests/test.rem(110): Trig = Sunday, 17 February, 1991 REM Tue 28 Jan 1992 MSG Tue 28 Jan 1992 -../tests/test.rem(108): Trig = Tuesday, 28 January, 1992 +../tests/test.rem(111): Trig = Tuesday, 28 January, 1992 # Try some Backs CLEAR-OMIT-CONTEXT REM 1 -1 OMIT sat sun MSG 1 -1 OMIT Sat Sun -../tests/test.rem(112): Trig = Thursday, 28 February, 1991 +../tests/test.rem(115): Trig = Thursday, 28 February, 1991 REM 1 --1 OMIT sat sun MSG 1 --1 OMIT Sat Sun -../tests/test.rem(113): Trig = Thursday, 28 February, 1991 +../tests/test.rem(116): Trig = Thursday, 28 February, 1991 OMIT 28 Feb REM 1 -1 OMIT sat sun MSG 1 -1 OMIT Sat Sun (28 Feb omitted) -../tests/test.rem(116): Trig = Wednesday, 27 February, 1991 +../tests/test.rem(119): Trig = Wednesday, 27 February, 1991 REM 1 --1 OMIT sat sun MSG 1 --1 OMIT Sat Sun (28 Feb omitted) -../tests/test.rem(117): Trig = Thursday, 28 February, 1991 +../tests/test.rem(120): Trig = Thursday, 28 February, 1991 CLEAR-OMIT-CONTEXT # Try out UNTIL REM Wed UNTIL 21 Feb 1991 MSG Wed UNTIL 21 Feb 1991 -../tests/test.rem(122): Trig = Wednesday, 20 February, 1991 +../tests/test.rem(125): Trig = Wednesday, 20 February, 1991 # Try playing with the OMIT context OMIT 28 Feb 1991 REM 1 Mar -1 MSG 1 mar -1 (28feb91 omitted) -../tests/test.rem(127): Trig = Wednesday, 27 February, 1991 +../tests/test.rem(130): Trig = Wednesday, 27 February, 1991 REM 1 Mar --1 MSG 1 mar --1 (28Feb91 omitted) -../tests/test.rem(128): Trig = Thursday, 28 February, 1991 +../tests/test.rem(131): Trig = Thursday, 28 February, 1991 REM 28 Feb BEFORE MSG 28 Feb BEFORE (28Feb91 omitted) -../tests/test.rem(129): Trig = Wednesday, 27 February, 1991 +../tests/test.rem(132): Trig = Wednesday, 27 February, 1991 REM 28 Feb SKIP MSG 28 Feb SKIP (28Feb91 omitted) -../tests/test.rem(130): Trig = Friday, 28 February, 1992 +../tests/test.rem(133): Trig = Friday, 28 February, 1992 REM 28 Feb AFTER MSG 28 Feb AFTER (28Feb91 omitted) -../tests/test.rem(131): Trig = Friday, 1 March, 1991 +../tests/test.rem(134): Trig = Friday, 1 March, 1991 PUSH-OMIT-CONTEXT CLEAR-OMIT-CONTEXT REM 1 Mar -1 MSG 1 mar -1 -../tests/test.rem(135): Trig = Thursday, 28 February, 1991 -REM 1 Mar --1 MSG 1 mar --1 -../tests/test.rem(136): Trig = Thursday, 28 February, 1991 -REM 28 Feb BEFORE MSG 28 Feb BEFORE -../tests/test.rem(137): Trig = Thursday, 28 February, 1991 -REM 28 Feb SKIP MSG 28 Feb SKIP ../tests/test.rem(138): Trig = Thursday, 28 February, 1991 -REM 28 Feb AFTER MSG 28 Feb AFTER +REM 1 Mar --1 MSG 1 mar --1 ../tests/test.rem(139): Trig = Thursday, 28 February, 1991 +REM 28 Feb BEFORE MSG 28 Feb BEFORE +../tests/test.rem(140): Trig = Thursday, 28 February, 1991 +REM 28 Feb SKIP MSG 28 Feb SKIP +../tests/test.rem(141): Trig = Thursday, 28 February, 1991 +REM 28 Feb AFTER MSG 28 Feb AFTER +../tests/test.rem(142): Trig = Thursday, 28 February, 1991 POP-OMIT-CONTEXT REM 1 Mar -1 MSG 1 mar -1 (28feb91 omitted) -../tests/test.rem(142): Trig = Wednesday, 27 February, 1991 +../tests/test.rem(145): Trig = Wednesday, 27 February, 1991 REM 1 Mar --1 MSG 1 mar --1 (28Feb91 omitted) -../tests/test.rem(143): Trig = Thursday, 28 February, 1991 +../tests/test.rem(146): Trig = Thursday, 28 February, 1991 REM 28 Feb BEFORE MSG 28 Feb BEFORE (28Feb91 omitted) -../tests/test.rem(144): Trig = Wednesday, 27 February, 1991 +../tests/test.rem(147): Trig = Wednesday, 27 February, 1991 REM 28 Feb SKIP MSG 28 Feb SKIP (28Feb91 omitted) -../tests/test.rem(145): Trig = Friday, 28 February, 1992 +../tests/test.rem(148): Trig = Friday, 28 February, 1992 REM 28 Feb AFTER MSG 28 Feb AFTER (28Feb91 omitted) -../tests/test.rem(146): Trig = Friday, 1 March, 1991 +../tests/test.rem(149): Trig = Friday, 1 March, 1991 REM 13 March 1991 *1 UNTIL 19 March 1991 MSG 13-19 Mar 91 -../tests/test.rem(149): Trig = Wednesday, 13 March, 1991 +../tests/test.rem(152): Trig = Wednesday, 13 March, 1991 # Test BACK CLEAR-OMIT-CONTEXT REM 18 Feb 1991 +1 MSG 18 Feb 1991 +1 -../tests/test.rem(153): Trig = Monday, 18 February, 1991 +../tests/test.rem(156): Trig = Monday, 18 February, 1991 OMIT 17 Feb 1991 REM 18 Feb 1991 +1 MSG 18 Feb 1991 +1 (17Feb91 omitted) -../tests/test.rem(156): Trig = Monday, 18 February, 1991 +../tests/test.rem(159): Trig = Monday, 18 February, 1991 18 Feb 1991 +1 (17Feb91 omitted) REM 18 Feb 1991 ++1 MSG 18 Feb 1991 ++1 (17Feb91 omitted) -../tests/test.rem(157): Trig = Monday, 18 February, 1991 +../tests/test.rem(160): Trig = Monday, 18 February, 1991 CLEAR-OMIT-CONTEXT # Test the scanfrom clause REM Fri SATISFY 1 -../tests/test.rem(161): Trig = Friday, 22 February, 1991 +../tests/test.rem(164): Trig = Friday, 22 February, 1991 OMIT [trigger(trigdate())] trigdate() => 1991-02-22 trigger(1991-02-22) => "22 February 1991" REM Fri after MSG 23 Feb 1991 -../tests/test.rem(163): Trig = Saturday, 23 February, 1991 +../tests/test.rem(166): Trig = Saturday, 23 February, 1991 CLEAR-OMIT-CONTEXT REM Fri SCANFROM [trigger(today()-7)] SATISFY 1 today() => 1991-02-16 1991-02-16 - 7 => 1991-02-09 trigger(1991-02-09) => "9 February 1991" -../tests/test.rem(165): Trig = Friday, 15 February, 1991 +../tests/test.rem(168): Trig = Friday, 15 February, 1991 OMIT [trigger(trigdate())] trigdate() => 1991-02-15 trigger(1991-02-15) => "15 February 1991" REM Fri after MSG 16 Feb 1991 -../tests/test.rem(167): Trig = Saturday, 16 February, 1991 +../tests/test.rem(170): Trig = Saturday, 16 February, 1991 16 Feb 1991 CLEAR-OMIT-CONTEXT @@ -586,7 +590,7 @@ day(1991-03-08) => 8 8 % 2 => 0 0 || 0 => 0 Leaving UserFN _ofunc() => 0 -../tests/test.rem(172): Trig = Friday, 8 March, 1991 +../tests/test.rem(175): Trig = Friday, 8 March, 1991 REM 8 March OMITFUNC _ofunc -1 MSG OmitFunc Test 2 Entering UserFN _ofunc(1991-03-07) x => 1991-03-07 @@ -660,31 +664,31 @@ day(1991-02-28) => 28 28 % 2 => 0 0 || 0 => 0 Leaving UserFN _ofunc() => 0 -../tests/test.rem(173): Trig = Thursday, 28 February, 1991 +../tests/test.rem(176): Trig = Thursday, 28 February, 1991 # omitfunc ignores local/global omits fset _ofunc(x) 0 OMIT 1 March OMIT 2 March 1991 REM 1 March OMIT Sun OMITFUNC _ofunc AFTER MSG Should trigger 1 March -../tests/test.rem(179): Warning: OMIT is ignored if you use OMITFUNC +../tests/test.rem(182): Warning: OMIT is ignored if you use OMITFUNC Entering UserFN _ofunc(1991-02-15) Leaving UserFN _ofunc() => 0 Entering UserFN _ofunc(1991-03-01) Leaving UserFN _ofunc() => 0 -../tests/test.rem(179): Trig = Friday, 1 March, 1991 +../tests/test.rem(182): Trig = Friday, 1 March, 1991 REM 1 March OMIT Sun AFTER MSG Should trigger 4 March -../tests/test.rem(180): Trig = Monday, 4 March, 1991 +../tests/test.rem(183): Trig = Monday, 4 March, 1991 # Test shorthand reminders REM 1991-02-28 MSG Feb 28 -../tests/test.rem(183): Trig = Thursday, 28 February, 1991 +../tests/test.rem(186): Trig = Thursday, 28 February, 1991 REM 1991/02/28@14:45 MSG Feb 28 -../tests/test.rem(184): Trig = Thursday, 28 February, 1991 +../tests/test.rem(187): Trig = Thursday, 28 February, 1991 REM Wed UNTIL 1991-01-01 MSG Expired -../tests/test.rem(185): Expired +../tests/test.rem(188): Expired REM Wed SCANFROM 1991-02-26 MSG SCANFROM -../tests/test.rem(186): Trig = Wednesday, 27 February, 1991 +../tests/test.rem(189): Trig = Wednesday, 27 February, 1991 set a000 abs(1) abs(1) => 1 @@ -708,7 +712,7 @@ set a008 coerce("string", 11:44) coerce("string", 11:44) => "11:44" set a009 coerce("int", "badnews") coerce("int", "badnews") => Can't coerce -../tests/test.rem(197): Can't coerce +../tests/test.rem(200): Can't coerce set a010 coerce("int", "12") coerce("int", "12") => 12 set a011 coerce("int", 11:44) @@ -720,7 +724,7 @@ set a013 date(1992, 2, 2) date(1992, 2, 2) => 1992-02-02 set a014 date(1993, 2, 29) date(1993, 2, 29) => Bad date specification -../tests/test.rem(202): Bad date specification +../tests/test.rem(205): Bad date specification set a015 day(today()) today() => 1991-02-16 day(1991-02-16) => 16 @@ -815,15 +819,15 @@ strlen("sadjflkhsldkfhsdlfjhk") => 21 set a050 substr(a049, 2) a049 => 21 substr(21, 2) => Type mismatch -../tests/test.rem(240): Type mismatch +../tests/test.rem(243): Type mismatch set a051 substr(a050, 2, 6) -a050 => ../tests/test.rem(241): Undefined variable: a050 +a050 => ../tests/test.rem(244): Undefined variable: a050 set a052 time(1+2, 3+4) 1 + 2 => 3 3 + 4 => 7 time(3, 7) => 03:07 rem 10 jan 1992 AT 11:22 CAL -../tests/test.rem(243): Trig = Friday, 10 January, 1992 +../tests/test.rem(246): Trig = Friday, 10 January, 1992 set a053 trigdate() trigdate() => 1992-01-10 set a054 trigtime() @@ -915,101 +919,101 @@ y => 11:33 x => "foo" y => 11:33 "foo" * 11:33 => Type mismatch -../tests/test.rem(266): `*': Type mismatch +../tests/test.rem(269): `*': Type mismatch Leaving UserFN h() => Type mismatch set a074 dosubst("%a %b %c %d %e %f %g %h", '1992/5/5') dosubst("%a %b %c %d %e %f %g %h", 1992-05-05) => "on Tuesday, 5 May, 1992 in 444 days' tim"... msg [a074]% -../tests/test.rem(268): Trig = Saturday, 16 February, 1991 +../tests/test.rem(271): Trig = Saturday, 16 February, 1991 a074 => "on Tuesday, 5 May, 1992 in 444 days' tim"... on Tuesday, 5 May, 1992 in 444 days' time on Tuesday 5 on 05-05-1992 on 05-05-1992 on Tuesday, 5 May on 05-05 set a075 dosubst("%i %j %k %l %m %n %o %p", '1992/5/5') dosubst("%i %j %k %l %m %n %o %p", 1992-05-05) => "on 05-05 on Tuesday, May 5th, 1992 on Tu"... msg [a075]% -../tests/test.rem(270): Trig = Saturday, 16 February, 1991 +../tests/test.rem(273): Trig = Saturday, 16 February, 1991 a075 => "on 05-05 on Tuesday, May 5th, 1992 on Tu"... on 05-05 on Tuesday, May 5th, 1992 on Tuesday, May 5th on 1992-05-05 May 5 s set a076 dosubst("%q %r %s %t %u %v %w %x", '1992/5/5') dosubst("%q %r %s %t %u %v %w %x", 1992-05-05) => "s' 05 th 05 on Tuesday, 5th May, 1992 on"... msg [a076]% -../tests/test.rem(272): Trig = Saturday, 16 February, 1991 +../tests/test.rem(275): Trig = Saturday, 16 February, 1991 a076 => "s' 05 th 05 on Tuesday, 5th May, 1992 on"... s' 05 th 05 on Tuesday, 5th May, 1992 on Tuesday, 5th May Tuesday 444 set a074 dosubst("%*a %*b %*c %*d %*e %*f %*g %*h", '1992/5/5') dosubst("%*a %*b %*c %*d %*e %*f %*g %*h", 1992-05-05) => "Tuesday, 5 May, 1992 in 444 days' time T"... msg [a074]% -../tests/test.rem(274): Trig = Saturday, 16 February, 1991 +../tests/test.rem(277): Trig = Saturday, 16 February, 1991 a074 => "Tuesday, 5 May, 1992 in 444 days' time T"... Tuesday, 5 May, 1992 in 444 days' time Tuesday 5 05-05-1992 05-05-1992 Tuesday, 5 May 05-05 set a075 dosubst("%*i %*j %*k %*l %*m %*n %*o %*p", '1992/5/5') dosubst("%*i %*j %*k %*l %*m %*n %*o %*p", 1992-05-05) => "05-05 Tuesday, May 5th, 1992 Tuesday, Ma"... msg [a075]% -../tests/test.rem(276): Trig = Saturday, 16 February, 1991 +../tests/test.rem(279): Trig = Saturday, 16 February, 1991 a075 => "05-05 Tuesday, May 5th, 1992 Tuesday, Ma"... 05-05 Tuesday, May 5th, 1992 Tuesday, May 5th 1992-05-05 May 5 s set a076 dosubst("%*q %*r %*s %*t %*u %*v %*w %*x", '1992/5/5') dosubst("%*q %*r %*s %*t %*u %*v %*w %*x", 1992-05-05) => "s' 05 th 05 Tuesday, 5th May, 1992 Tuesd"... msg [a076]% -../tests/test.rem(278): Trig = Saturday, 16 February, 1991 +../tests/test.rem(281): Trig = Saturday, 16 February, 1991 a076 => "s' 05 th 05 Tuesday, 5th May, 1992 Tuesd"... s' 05 th 05 Tuesday, 5th May, 1992 Tuesday, 5th May Tuesday 444 set a077 dosubst("%*y %*z", '1992/5/5') dosubst("%*y %*z", 1992-05-05) => "1992 92 " msg [a077]% -../tests/test.rem(280): Trig = Saturday, 16 February, 1991 +../tests/test.rem(283): Trig = Saturday, 16 February, 1991 a077 => "1992 92 " 1992 92 set a074 dosubst("%A %B %C %D %E %F %G %H", '1992/5/5') dosubst("%A %B %C %D %E %F %G %H", 1992-05-05) => "On Tuesday, 5 May, 1992 In 444 days' tim"... msg [a074]% -../tests/test.rem(282): Trig = Saturday, 16 February, 1991 +../tests/test.rem(285): Trig = Saturday, 16 February, 1991 a074 => "On Tuesday, 5 May, 1992 In 444 days' tim"... On Tuesday, 5 May, 1992 In 444 days' time On Tuesday 5 On 05-05-1992 On 05-05-1992 On Tuesday, 5 May On 05-05 set a075 dosubst("%I %J %K %L %M %N %O %P", '1992/5/5') dosubst("%I %J %K %L %M %N %O %P", 1992-05-05) => "On 05-05 On Tuesday, May 5th, 1992 On Tu"... msg [a075]% -../tests/test.rem(284): Trig = Saturday, 16 February, 1991 +../tests/test.rem(287): Trig = Saturday, 16 February, 1991 a075 => "On 05-05 On Tuesday, May 5th, 1992 On Tu"... On 05-05 On Tuesday, May 5th, 1992 On Tuesday, May 5th On 1992-05-05 May 5 S set a076 dosubst("%Q %R %S %T %U %V %W %X", '1992/5/5') dosubst("%Q %R %S %T %U %V %W %X", 1992-05-05) => "S' 05 Th 05 On Tuesday, 5th May, 1992 On"... msg [a076]% -../tests/test.rem(286): Trig = Saturday, 16 February, 1991 +../tests/test.rem(289): Trig = Saturday, 16 February, 1991 a076 => "S' 05 Th 05 On Tuesday, 5th May, 1992 On"... S' 05 Th 05 On Tuesday, 5th May, 1992 On Tuesday, 5th May Tuesday 444 set a077 dosubst("%Y %Z", '1992/5/5') dosubst("%Y %Z", 1992-05-05) => "1992 92 " msg [a077]% -../tests/test.rem(288): Trig = Saturday, 16 February, 1991 +../tests/test.rem(291): Trig = Saturday, 16 February, 1991 a077 => "1992 92 " 1992 92 set a074 dosubst("%*A %*B %*C %*D %*E %*F %*G %*H", '1992/5/5') dosubst("%*A %*B %*C %*D %*E %*F %*G %*H", 1992-05-05) => "Tuesday, 5 May, 1992 In 444 days' time T"... msg [a074]% -../tests/test.rem(290): Trig = Saturday, 16 February, 1991 +../tests/test.rem(293): Trig = Saturday, 16 February, 1991 a074 => "Tuesday, 5 May, 1992 In 444 days' time T"... Tuesday, 5 May, 1992 In 444 days' time Tuesday 5 05-05-1992 05-05-1992 Tuesday, 5 May 05-05 set a075 dosubst("%*I %*J %*K %*L %*M %*N %*O %*P", '1992/5/5') dosubst("%*I %*J %*K %*L %*M %*N %*O %*P", 1992-05-05) => "05-05 Tuesday, May 5th, 1992 Tuesday, Ma"... msg [a075]% -../tests/test.rem(292): Trig = Saturday, 16 February, 1991 +../tests/test.rem(295): Trig = Saturday, 16 February, 1991 a075 => "05-05 Tuesday, May 5th, 1992 Tuesday, Ma"... 05-05 Tuesday, May 5th, 1992 Tuesday, May 5th 1992-05-05 May 5 S set a076 dosubst("%*Q %*R %*S %*T %*U %*V %*W %*X", '1992/5/5') dosubst("%*Q %*R %*S %*T %*U %*V %*W %*X", 1992-05-05) => "S' 05 Th 05 Tuesday, 5th May, 1992 Tuesd"... msg [a076]% -../tests/test.rem(294): Trig = Saturday, 16 February, 1991 +../tests/test.rem(297): Trig = Saturday, 16 February, 1991 a076 => "S' 05 Th 05 Tuesday, 5th May, 1992 Tuesd"... S' 05 Th 05 Tuesday, 5th May, 1992 Tuesday, 5th May Tuesday 444 set a077 dosubst("%*Y %*Z", '1992/5/5') dosubst("%*Y %*Z", 1992-05-05) => "1992 92 " msg [a077]% -../tests/test.rem(296): Trig = Saturday, 16 February, 1991 +../tests/test.rem(299): Trig = Saturday, 16 February, 1991 a077 => "1992 92 " 1992 92 @@ -1118,10 +1122,10 @@ dump a083 1991-03-24 OMIT 2010-09-03 THROUGH 2010-09-15 OMIT December 25 MSG X -../tests/test.rem(308): Trig = Wednesday, 25 December, 1991 +../tests/test.rem(311): Trig = Wednesday, 25 December, 1991 # Next should give a parse error OMIT 26 Dec 2010 THROUGH 27 Dec 2010 MSG This is not legal -../tests/test.rem(310): Trig = Sunday, 26 December, 2010 +../tests/test.rem(313): Trig = Sunday, 26 December, 2010 OMIT DUMP Global Full OMITs (16 of maximum allowed 500): 1991-03-11 diff --git a/tests/test.rem b/tests/test.rem index ec87b103..976d4103 100644 --- a/tests/test.rem +++ b/tests/test.rem @@ -9,6 +9,9 @@ REM Wed UNTIL 15 Feb 1991 SATISFY [trigdate() > '1990-01-01'] MSG wookie +# bad AT +REM AT 0:00 0:01 0:02 MSG foo + REM MSG Today is [hebday(today())] [hebmon(today())] [hebyear(today())] fset _h(x, y) trigger(hebdate(x,y))