Add tests for purge mode.

This commit is contained in:
David F. Skoll
2010-04-20 15:20:49 -04:00
parent 501c04f4b6
commit 70adbf90c2
7 changed files with 114 additions and 3 deletions

View File

@@ -1025,6 +1025,8 @@ void DoExit(ParsePtr p)
int r;
Value v;
if (PurgeMode) return;
r = EvaluateExpr(p, &v);
if (r || v.type != INT_TYPE) exit(99);
exit(v.v.val);
@@ -1046,6 +1048,8 @@ int DoErrMsg(ParsePtr p)
DynamicBuffer buf;
if (PurgeMode) return OK;
DBufInit(&buf);
t.typ = MSG_TYPE;
tt.ttime = SystemTime(0) / 60;

View File

@@ -390,6 +390,8 @@ int DoDump(ParsePtr p)
Var *v;
DynamicBuffer buf;
if (PurgeMode) return OK;
DBufInit(&buf);
r = ParseToken(p, &buf);
if (r) return r;

View File

@@ -1,6 +1,6 @@
# This is f1.rem
INCLUDE f2.rem
INCLUDE f2.rem
INCLUDE [filedir()]/f2.rem
INCLUDE [filedir()]/f2.rem
REM 1 Oct 1991 MSG old1.

View File

@@ -3,4 +3,4 @@
REM 3 feb 2012 MSG new
REM 3 1998 MSG old
INCLUDE f3.rem
INCLUDE [filedir()]/f3.rem

View File

@@ -23,3 +23,25 @@ REM [1990+1] \
REM 1990 \
MSG expired-continued-line
OMIT 25 Dec MSG woaaahh!
OMIT 24 Dec
OMIT 1 Jan 1992 MSG woaaahah... expired
OMIT 2 Jan 1992
ERRMSG blorky
FLUSH
SET a 1
FSET a(x) x*x
UNSET a
CLEAR-OMIT-CONTEXT
PUSH-OMIT-CONTEXT
POP-OMIT-CONTEXT
BANNER wow
DEBUG +x
DEBUG -x
DUMP $
EXIT 0
PRESERVE i

View File

@@ -67,6 +67,16 @@ echo "Sort Test" >> ../tests/test.out
(echo "REM AT 12:00 MSG Untimed"; echo "REM MSG Timed") | ../src/remind -gaaa - 1 Jan 2000 >> ../tests/test.out 2>&1
(echo "REM AT 12:00 MSG Untimed"; echo "REM MSG Timed") | ../src/remind -gaaad - 1 Jan 2000 >> ../tests/test.out 2>&1
echo "Purge Test" >> ../tests/test.out
../src/remind -j ../tests/purge_dir/f1.rem >> ../tests/test.out 2>&1
echo "F1" >> ../tests/test.out
cat ../tests/purge_dir/f1.rem.purged >> ../tests/test.out
echo "F2" >> ../tests/test.out
cat ../tests/purge_dir/f2.rem.purged >> ../tests/test.out
echo "F3" >> ../tests/test.out
cat ../tests/purge_dir/f3.rem.purged >> ../tests/test.out
rm -f ../tests/purge_dir/*.rem.purged >> ../tests/test.out 2>&1
../src/remind ../tests/runtest.rem >> ../tests/test.out 2>&1
../src/remind -p ../tests/shade.rem 1 August 2009 | ../src/rem2ps -e -l -c3 >> ../tests/test.out 2>&1

View File

@@ -2150,6 +2150,79 @@ Timed
Untimed
Purge Test
F1
# This is f1.rem
INCLUDE [filedir()]/f2.rem
INCLUDE [filedir()]/f2.rem
#!P: Expired: REM 1 Oct 1991 MSG old1.
#!P: Expired: REM Monday UNTIL 1 Oct 1991 MSG old2.
F2
# This is f2.rem
REM 3 feb 2012 MSG new
#!P: Expired: REM 3 1998 MSG old
INCLUDE [filedir()]/f3.rem
F3
# This is f3.rem
REM Mon MSG repeat
#!P: Cannot purge SATISFY-type reminders
REM Mon SATISFY [1] MSG repeat
#!P: The next IF evaluated false...
#!P: REM statements in IF block not checked for purging.
IF 0
REM 1991 MSG wookie
ENDIF
IF 1
#!P: Expired: REM 1991 MSG wookie
ENDIF
#!P: The next IFTRIG did not trigger.
#!P: REM statements in IFTRIG block not checked for purging.
IFTRIG 1991
REM MSG wookie
ENDIF
#!P: Next line may have expired, but contains expression
REM [1990+1] MSG old-with-expression
#!P: Next line may have expired, but contains expression
REM [1990+1] \
MSG Continued line
#!P: Expired: REM 1990 \
MSG expired-continued-line
OMIT 25 Dec MSG woaaahh!
OMIT 24 Dec
#!P: Expired: OMIT 1 Jan 1992 MSG woaaahah... expired
OMIT 2 Jan 1992
ERRMSG blorky
FLUSH
SET a 1
FSET a(x) x*x
UNSET a
CLEAR-OMIT-CONTEXT
PUSH-OMIT-CONTEXT
POP-OMIT-CONTEXT
BANNER wow
DEBUG +x
DEBUG -x
DUMP $
EXIT 0
PRESERVE i
../tests/runtest.rem(2): shell(): RUN disabled
../tests/runinc.rem(1): shell(): RUN disabled
../tests/runinc.rem(3): shell(): RUN disabled