#
#  Tests for parsing attribute filers
#
#  $Id: 6b3f89aec9d928a64755b109f6945ceda279d6fb $
#

proto-dictionary radius

condition &User-Name[0] == "foo"
match (&User-Name[0] == "foo")

#
#  This is a run-time error.  [#] returns an integer.
#
condition &User-Name[#] == "foo"
match (&User-Name[#] == "foo")

#
#  This is a run-time error.  [*] returns a list.
#
condition &User-Name[*] == "foo"
match (&User-Name[*] == "foo")

condition &User-Name[n] == "foo"
match (&User-Name[n] == "foo")

condition &User-Name[-1] == "foo"
match ERROR offset 12: Invalid array index

#
#  tmpl_dcursor.c has an assert which fails if you try to use
#  conditional filters.
#
#  And we do not (yet) allow for filters on leaf attributes.  See
#
#  @todo - feature - allow expressions in tmpl_attr_parse_filter(()
#
condition &User-Name[(&User-Name == 'bar')] == "foo"
match ERROR offset 12: Invalid filter - cannot use filter on leaf attributes

#
#  The condition code doesn't allow &Group-Thingy == { &foo = bar }
#
#  Arguably it could, but that wouldn't help here.
#
#  What we really want to allow is a filter for use with 'foreach':
#
#	foreach &TLS-Certificate[&Common-Name == 'user@example.com'] { ... }
#
#  which is a loop that returns &TLS-Certificate.
#
#  @todo - feature - this error is misleading and wrong.
#
condition &TLS-Certificate[(&Common-Name == 'user@example.com')] == bar
match ERROR offset 1: Cannot use list references in condition

count
match 15
