mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
common: Add string operator gt,ge,le,lt to recsel.
* common/recsel.c (recsel_parse_expr): Add them. (recsel_dump): Print them. (recsel_select): Evaluate them. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
c8e0d37f41
commit
959cd8903f
3 changed files with 101 additions and 3 deletions
|
@ -171,6 +171,8 @@ test_2_getval (void *cookie, const char *name)
|
|||
return " ";
|
||||
else if (!strcmp (name, "letters"))
|
||||
return "abcde";
|
||||
else if (!strcmp (name, "str1"))
|
||||
return "aaa";
|
||||
else
|
||||
return cookie;
|
||||
}
|
||||
|
@ -263,6 +265,37 @@ run_test_2 (void)
|
|||
fail (0, 0);
|
||||
|
||||
|
||||
FREEEXPR();
|
||||
ADDEXPR ("str1 -gt aa");
|
||||
if (!recsel_select (se, test_2_getval, NULL))
|
||||
fail (0, 0);
|
||||
FREEEXPR();
|
||||
ADDEXPR ("str1 -gt aaa");
|
||||
if (recsel_select (se, test_2_getval, NULL))
|
||||
fail (0, 0);
|
||||
FREEEXPR();
|
||||
ADDEXPR ("str1 -ge aaa");
|
||||
if (!recsel_select (se, test_2_getval, NULL))
|
||||
fail (0, 0);
|
||||
FREEEXPR();
|
||||
ADDEXPR ("str1 -lt aab");
|
||||
if (!recsel_select (se, test_2_getval, NULL))
|
||||
fail (0, 0);
|
||||
FREEEXPR();
|
||||
ADDEXPR ("str1 -le aaa");
|
||||
if (!recsel_select (se, test_2_getval, NULL))
|
||||
fail (0, 0);
|
||||
|
||||
FREEEXPR();
|
||||
ADDEXPR ("-c str1 -lt AAB");
|
||||
if (recsel_select (se, test_2_getval, NULL))
|
||||
fail (0, 0);
|
||||
FREEEXPR();
|
||||
ADDEXPR ("str1 -lt AAB");
|
||||
if (!recsel_select (se, test_2_getval, NULL))
|
||||
fail (0, 0);
|
||||
|
||||
|
||||
FREEEXPR();
|
||||
ADDEXPR ("uid -n");
|
||||
if (!recsel_select (se, test_2_getval, NULL))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue