From: Alan T. DeKok Date: Wed, 26 Jan 2022 20:24:51 +0000 (-0500) Subject: more notes and tests X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4912b4bdf4f11cc2de4495073faf4ef3ee3468a5;p=thirdparty%2Ffreeradius-server.git more notes and tests --- diff --git a/src/lib/unlang/xlat_expr.c b/src/lib/unlang/xlat_expr.c index 072db28bf81..e65c36b900f 100644 --- a/src/lib/unlang/xlat_expr.c +++ b/src/lib/unlang/xlat_expr.c @@ -44,6 +44,11 @@ RCSID("$Id$") * doesn't need to interpret the LHS, but just knows its limits. We perhaps want a "range compare" * function, which just checks ranges on one side against values on the right. * + * Even worse, when we do "((bool) 1) < 3", the RHS is cast to the type of the LHS by + * tmpl_afrom_substr(). This is because we pass the LHS data type recursively down, which works most of + * the time, but not all of the time. There are currently hacks in the "upcast" code here to fix this, + * but it's a hack. + * * @todo - Regular expressions are not handled. This isn't a lot of work, but can be a bit finicky. * * @todo - short-circuit && / || need to be updated. This requires various magic in their instantiation diff --git a/src/tests/unit/xlat/expr.txt b/src/tests/unit/xlat/expr.txt index f61d6302595..bac3e29f2b9 100644 --- a/src/tests/unit/xlat/expr.txt +++ b/src/tests/unit/xlat/expr.txt @@ -106,5 +106,16 @@ match ((1 < 2) < 3) xlat_expr (uint32) %(concat:1 2) match %(cast_expression:uint32 %(concat:1 2)) +# +# Mashing multiple brackets together. The brackets are removed as +# part of the parsing step, because no intermediate nodes are created for them. +# +xlat_expr (((1 + 2))) +match (1 + 2) + +xlat_expr (((1 + 2)) * ((3 + 4))) +match ((1 + 2) * (3 + 4)) + + count -match 51 +match 55