mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 06:18:47 +02:00
Issue warning if a substitution sequence related to time is used without an AT clause.
All checks were successful
Remind unit tests / tests (push) Successful in 31s
All checks were successful
Remind unit tests / tests (push) Successful in 31s
This commit is contained in:
@@ -79,6 +79,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
int origLen = DBufLen(dbuf);
|
||||
int altmode;
|
||||
int r;
|
||||
int origtime;
|
||||
Value v;
|
||||
UserFunc *func;
|
||||
|
||||
@@ -87,6 +88,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
if (tt) {
|
||||
tim = tt->ttime;
|
||||
}
|
||||
origtime = tim;
|
||||
if (tim == NO_TIME) tim = curtime;
|
||||
tdiff = tim - curtime;
|
||||
adiff = ABS(tdiff);
|
||||
@@ -405,6 +407,12 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
Eprint("%s", GetErr(r));
|
||||
}
|
||||
}
|
||||
if (origtime == NO_TIME) {
|
||||
if ((c >= '0' && c <= '9') || (c == '!')) {
|
||||
Wprint(tr("`%%%c' substitution sequence should not be used without an AT clause"), c);
|
||||
}
|
||||
}
|
||||
|
||||
switch(UPPER(c)) {
|
||||
case 'A':
|
||||
if (altmode == '*' || !strcmp(tr("on"), "")) {
|
||||
|
||||
@@ -690,6 +690,11 @@ set a "\x0P"
|
||||
set a "\x00P"
|
||||
EOF
|
||||
|
||||
# Test diagnostics when using a timed substitution without an AT clause
|
||||
../src/remind - 1 Feb 2024 1:00 <<EOF >> ../tests/test.out 2>&1
|
||||
REM MSG %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 %! hahaha
|
||||
EOF
|
||||
|
||||
# Test translate table dumping
|
||||
../src/remind - 1 Feb 2024 <<EOF >> ../tests/test.out 2>&1
|
||||
TRANSLATE "\x03" "BREAK"
|
||||
|
||||
@@ -24548,6 +24548,7 @@ TRANSLATE "Warning: Useless use of UNTIL with fully-specified date and no *rep"
|
||||
TRANSLATE "Warning: Variable name `%.*s...' truncated to `%.*s'" ""
|
||||
TRANSLATE "You have OMITted everything! The space-time continuum is at risk." ""
|
||||
TRANSLATE "\\x00 is not a valid escape sequence" ""
|
||||
TRANSLATE "`%%%c' substitution sequence should not be used without an AT clause" ""
|
||||
TRANSLATE "did you mean" ""
|
||||
TRANSLATE "here" ""
|
||||
TRANSLATE "psmoon() is deprecated; use SPECIAL MOON instead." ""
|
||||
@@ -24691,6 +24692,21 @@ a "xPOO"
|
||||
-stdin-(24): \x00 is not a valid escape sequence
|
||||
-stdin-(25): \x00 is not a valid escape sequence
|
||||
-stdin-(26): \x00 is not a valid escape sequence
|
||||
-stdin-(1): `%0' substitution sequence should not be used without an AT clause
|
||||
-stdin-(1): `%1' substitution sequence should not be used without an AT clause
|
||||
-stdin-(1): `%2' substitution sequence should not be used without an AT clause
|
||||
-stdin-(1): `%3' substitution sequence should not be used without an AT clause
|
||||
-stdin-(1): `%4' substitution sequence should not be used without an AT clause
|
||||
-stdin-(1): `%5' substitution sequence should not be used without an AT clause
|
||||
-stdin-(1): `%6' substitution sequence should not be used without an AT clause
|
||||
-stdin-(1): `%7' substitution sequence should not be used without an AT clause
|
||||
-stdin-(1): `%8' substitution sequence should not be used without an AT clause
|
||||
-stdin-(1): `%9' substitution sequence should not be used without an AT clause
|
||||
-stdin-(1): `%!' substitution sequence should not be used without an AT clause
|
||||
Reminders for Thursday, 1st February, 2024:
|
||||
|
||||
s now at 1:00am at 01:00 0 0 from now 0 0 s is hahaha
|
||||
|
||||
# Translation table
|
||||
TRANSLATE "LANGID" "en"
|
||||
TRANSLATE "\x03" "BREAK"
|
||||
|
||||
Reference in New Issue
Block a user