mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 06:18:47 +02:00
Document that logical operators can take any type; add tests.
This commit is contained in:
@@ -2232,9 +2232,6 @@ zero values are:
|
||||
\fBDATETIME\fR - '1990-01-01@00:00'
|
||||
.RE
|
||||
.PP
|
||||
Additionally, for the purpose of the IF command (but \fInot\fR the
|
||||
logical operators) the empty string "" is considered a false value.
|
||||
.PP
|
||||
.B OPERATORS
|
||||
.PP
|
||||
\fBRemind\fR has the following operators. Operators on the same line
|
||||
@@ -2256,7 +2253,7 @@ C operators.
|
||||
.PP
|
||||
.TP
|
||||
.B !
|
||||
Logical negation. Can be applied to an \fBINT\fR type. If the operand
|
||||
Logical negation. Can be applied to any type. If the operand
|
||||
is non-zero, returns zero. Otherwise, returns 1.
|
||||
.TP
|
||||
.B \-
|
||||
@@ -2361,15 +2358,12 @@ If the operands are not of the same type, == returns 0 and != returns
|
||||
.RE
|
||||
.TP
|
||||
.B &&
|
||||
This is the logical AND operator. Neither of its operands can be
|
||||
\fBSTRING\fR type. Returns the second operand if both operands are
|
||||
non-zero. Otherwise, returns whichever operand is zero.
|
||||
This is the logical AND operator. Returns the second operand if both
|
||||
operands are non-zero. Otherwise, returns whichever operand is zero.
|
||||
.TP
|
||||
.B ||
|
||||
This is the logical OR operator. Neither of its operands can be
|
||||
\fBSTRING\fR type. It returns the first operand that is non-zero; if
|
||||
both operands are zero, then returns the second operand.
|
||||
|
||||
This is the logical OR operator. It returns the first operand that is
|
||||
non-zero; if both operands are zero, then returns the second operand.
|
||||
.PP
|
||||
.B NOTES
|
||||
.PP
|
||||
|
||||
@@ -1037,6 +1037,46 @@ REM WARN gg MSG Wookie
|
||||
REM AT 11:00 SCHED gg MSG blork
|
||||
REM OMITFUNC gg MSG hehe
|
||||
|
||||
### Strings in logical operators
|
||||
SET logstr "" && 7
|
||||
SET logstr "foo" && 7
|
||||
SET logstr "" && ""
|
||||
SET logstr "foo" && ""
|
||||
SET logstr "" && "bar"
|
||||
SET logstr "foo" && "bar"
|
||||
SET logstr "" && '2023-02-01'
|
||||
SET logstr "foo" && '2023-02-01'
|
||||
|
||||
SET logstr "" || 7
|
||||
SET logstr "foo" || 7
|
||||
SET logstr "" || ""
|
||||
SET logstr "foo" || ""
|
||||
SET logstr "" || "bar"
|
||||
SET logstr "foo" || "bar"
|
||||
SET logstr "" || '2023-02-01'
|
||||
SET logstr "foo" || '2023-02-01'
|
||||
|
||||
set xyz ! 0
|
||||
set xyz ! 1
|
||||
set xyz ! 2
|
||||
|
||||
set xyz ! date(baseyr(), 1, 1)
|
||||
set xyz ! date(baseyr(), 1, 2)
|
||||
set xyz ! '2024-01-01'
|
||||
|
||||
set xyz ! datetime(baseyr(), 1, 1, 00:00)
|
||||
set xyz ! datetime(baseyr(), 1, 1, 00:01)
|
||||
set xyz ! datetime(baseyr(), 1, 2, 12:30)
|
||||
set xyz ! '2024-01-01@11:47'
|
||||
|
||||
set xyz ! 00:00
|
||||
set xyz ! 00:01
|
||||
set xyz ! 23:59
|
||||
|
||||
set xyz ! ""
|
||||
set xyz ! "foo"
|
||||
set xyz ! "0"
|
||||
|
||||
# Don't want Remind to queue reminders
|
||||
EXIT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user