]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move keyword tests to new xlat argument parser
authorAlan T. DeKok <aland@freeradius.org>
Sun, 9 Mar 2025 19:54:45 +0000 (15:54 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 9 Mar 2025 19:54:45 +0000 (15:54 -0400)
with a bit of good fortune, not all tests had to be updated.
However, there are still many tests which do unnecessary
expansions, ala

%foo(%{User-Name}

which is no longer necessary.  It may be useful to forbid that,
or to at least print an error message complaining about it.

42 files changed:
src/tests/keywords/all.mk
src/tests/keywords/attr-index-eval
src/tests/keywords/base64
src/tests/keywords/bin
src/tests/keywords/cast-time_delta
src/tests/keywords/cbor
src/tests/keywords/cmp-list-empty
src/tests/keywords/date
src/tests/keywords/debug
src/tests/keywords/edit-eval-rhs
src/tests/keywords/edit-multivalue
src/tests/keywords/escape
src/tests/keywords/escape-sequences
src/tests/keywords/expr-double
src/tests/keywords/filter_password
src/tests/keywords/foreach-explode
src/tests/keywords/foreach-explode-key
src/tests/keywords/foreach-key-ref
src/tests/keywords/hex
src/tests/keywords/if-failed-xlat
src/tests/keywords/if-regex-match-named
src/tests/keywords/if-skip
src/tests/keywords/if-tlv
src/tests/keywords/immutable
src/tests/keywords/join
src/tests/keywords/length
src/tests/keywords/mschap
src/tests/keywords/nexttime
src/tests/keywords/pairs
src/tests/keywords/randstr
src/tests/keywords/timeout
src/tests/keywords/tolower
src/tests/keywords/toupper
src/tests/keywords/xlat-arg-missing [new file with mode: 0644]
src/tests/keywords/xlat-config
src/tests/keywords/xlat-delay
src/tests/keywords/xlat-dhcpv4
src/tests/keywords/xlat-escape
src/tests/keywords/xlat-explode
src/tests/keywords/xlat-interpreter
src/tests/keywords/xlat-redundant
src/tests/keywords/xlat-subst

index 0fdf8d618d79072484571b85a4a0918cedc00c4b..78b64ac9887cb4456fcc9de09f8dc9ece115dacf 100644 (file)
@@ -86,6 +86,11 @@ $(OUTPUT)/${1}: $(BUILD_DIR)/lib/local/libfreeradius-dhcpv4.la $(BUILD_DIR)/lib/
 endif
 endif
 
+#
+#  Always use the new xlat parser
+#
+$(OUTPUT)/${1}: NEW_COND += -S xlat_func_bare_words=no
+
 endef
 $(foreach x,$(FILES),$(eval $(call KEYWORD_TEST,$x)))
 
@@ -152,7 +157,7 @@ KEYWORD_LIBS        := $(addsuffix .la,$(addprefix rlm_,$(KEYWORD_MODULES))) rlm_csv.la
 #      (make -k test.keywords 2>&1) | grep 'KEYWORD=' | sed 's/KEYWORD=//;s/ .*$//'
 #
 $(OUTPUT)/%: $(DIR)/% $(TEST_BIN_DIR)/unit_test_module | $(KEYWORD_RADDB) $(KEYWORD_LIBS) build.raddb rlm_test.la rlm_csv.la rlm_unpack.la
-       $(eval CMD:=KEYWORD=$(notdir $@) $(TEST_BIN)/unit_test_module $(NEW_COND) -S xlat_func_bare_words=yes $(UNIT_TEST_KEYWORD_ARGS.$(subst -,_,$(notdir $@))) -D share/dictionary -d src/tests/keywords/ -i "$@.attrs" -f "$@.attrs" -r "$@" -xx )
+       $(eval CMD:=KEYWORD=$(notdir $@) $(TEST_BIN)/unit_test_module $(NEW_COND) $(UNIT_TEST_KEYWORD_ARGS.$(subst -,_,$(notdir $@))) -D share/dictionary -d src/tests/keywords/ -i "$@.attrs" -f "$@.attrs" -r "$@" -xx )
        @echo "KEYWORD-TEST $(notdir $@)"
        ${Q}if ! $(CMD) > "$@.log" 2>&1 || ! test -f "$@"; then \
                if ! grep ERROR $< 2>&1 > /dev/null; then \
index c2ddf4ed20d9664323751c5a9db4f39ae8f207f3..d79f7076d7d574f65e2342d1c7463854cc2e93ad 100644 (file)
@@ -8,12 +8,12 @@ index := 1
 #
 #  Dynamically create an attribute reference
 #
-ref = "&Filter-Id[" + (string) index + "]"
+ref = "Filter-Id[" + (string) index + "]"
 
 #
-# Evaluate the attribute as an unlang expression.
+# Evaluate the contents of the attribute as an unlang expression.
 #
-foo = %eval(%{ref})
+foo = %eval(ref)
 
 if (foo != "b") {
        test_fail
@@ -21,7 +21,7 @@ if (foo != "b") {
 
 ref = "1 + 2"
 
-foo = %eval(%{ref})
+foo = %eval(ref)
 
 if (foo != 3) {
        test_fail
index 673ffd5bf8947494f6ccddea172a4df512f0fe6a..8b06f89891be196c3ed8aeac3a8773c1bd873ebb 100644 (file)
@@ -29,73 +29,73 @@ test_int64 = 1152921505566832445
 test_ipv4prefix = 57.56.55.62/32
 
 # String - bin 0x39383730
-test_output := %base64.encode(%{test_string})
+test_output := %base64.encode(test_string)
 if (!(test_output == 'OTg3MA==')) {
        test_fail
 }
 
 # Octets - bin 0x39383731
-test_output := %base64.encode(%{test_octets})
+test_output := %base64.encode(test_octets)
 if (!(test_output == 'OTg3MQ==')) {
        test_fail
 }
 
 # IP Address - bin 0x39383732
-test_output := %base64.encode(%{test_ipaddr})
+test_output := %base64.encode(test_ipaddr)
 if (!(test_output == 'OTg3Mg==')) {
        test_fail
 }
 
 # Integer - bin 0x39383734
-test_output := %base64.encode(%{test_int})
+test_output := %base64.encode(test_int)
 if (!(test_output == 'OTg3NA==')) {
        test_fail
 }
 
 # ifid - bin 0x0000000039383737
-test_output := %base64.encode(%{test_ifid})
+test_output := %base64.encode(test_ifid)
 if (!(test_output == 'AAAAADk4Nzc=')) {
        test_fail
 }
 
 # ipv6addr - bin 0x00000000000000000000000039383738
-test_output := %base64.encode(%{test_ipv6addr})
+test_output := %base64.encode(test_ipv6addr)
 if (!(test_output == 'AAAAAAAAAAAAAAAAOTg3OA==')) {
        test_fail
 }
 
 # ipv6addrprefix - bin 0x008000000000000000000000000039383739
-test_output := %base64.encode(%{test_ipv6prefix})
+test_output := %base64.encode(test_ipv6prefix)
 if (!(test_output == 'AIAAAAAAAAAAAAAAAAA5ODc5')) {
        test_fail
 }
 
 # byte - bin 0x3a
-test_output := %base64.encode(%{test_byte})
+test_output := %base64.encode(test_byte)
 if (!(test_output == 'Og==')) {
        test_fail
 }
 
 # short - bin 0x373b
-test_output := %base64.encode(%{test_short})
+test_output := %base64.encode(test_short)
 if (!(test_output == 'Nzs=')) {
        test_fail
 }
 
 # ethernet - bin 0x00003938373c
-test_output := %base64.encode(%{test_ether})
+test_output := %base64.encode(test_ether)
 if (!(test_output == 'AAA5ODc8')) {
        test_fail
 }
 
 # integer64 - bin 0x100000003938373d
-test_output := %base64.encode(%{test_int64})
+test_output := %base64.encode(test_int64)
 if (!(test_output == 'EAAAADk4Nz0=')) {
        test_fail
 }
 
 # ipv4prefix - bin 0x203938373e
-test_output := %base64.encode(%{test_ipv4prefix})
+test_output := %base64.encode(test_ipv4prefix)
 if (!(test_output == 'IDk4Nz4=')) {
        test_fail
 }
@@ -107,25 +107,25 @@ if (!(test_output == 'IDk4Nz4=')) {
 #}
 
 # Regression test, this used to crash...
-test_octets := %base64.decode(Zm9v)
+test_octets := %base64.decode('Zm9v')
 if (!(test_octets == "foo")) {
        debug_request
        test_fail
 }
 
-test_octets := %base64.decode(AIAAAAAAAAAAAAAAAAA5ODc5)
+test_octets := %base64.decode('AIAAAAAAAAAAAAAAAAA5ODc5')
 if (!(test_octets == 0x008000000000000000000000000039383739)) {
        test_fail
 }
 
 # Regression tests
-test_octets := %base64.decode(5RNqNl8iYLbkCc7JhR8as4TtDDCX6otuuWtcja8rITUyx9zrnHSe9tTHGmKK)
+test_octets := %base64.decode('5RNqNl8iYLbkCc7JhR8as4TtDDCX6otuuWtcja8rITUyx9zrnHSe9tTHGmKK')
 
 if (!(test_octets == 0xe5136a365f2260b6e409cec9851f1ab384ed0c3097ea8b6eb96b5c8daf2b213532c7dceb9c749ef6d4c71a628a)) {
        test_fail
 }
 
-test_octets := %base64.decode(eHfXPKZ+2iv9cnMV1MOmE/moYYA1Uk5xTmw4aVlMYmtDYzdKaFI4YXM0VHRERENYNm90dXVXdGNqYThySVRVeXg5enJuSFNlOXRUSEdtS0s=)
+test_octets := %base64.decode('eHfXPKZ+2iv9cnMV1MOmE/moYYA1Uk5xTmw4aVlMYmtDYzdKaFI4YXM0VHRERENYNm90dXVXdGNqYThySVRVeXg5enJuSFNlOXRUSEdtS0s=')
 
 if (!(test_octets == 0x7877d73ca67eda2bfd727315d4c3a613f9a8618035524e714e6c3869594c626b4363374a685238617334547444444358366f7475755774636a6138724954557978397a726e48536539745448476d4b4b)) {
        test_fail
index 02cdd07511defced44b0b7138b312627adad86fd..6bce16ea3db796367dba028ed40682a708b5412c 100644 (file)
@@ -43,7 +43,7 @@ request += {
        NAS-Identifier = '0x030405'
 }
 
-Class := %bin(%{NAS-Identifier[*]})
+Class := %bin(NAS-Identifier[*])
 
 if (Class[#] != 2) {
        test_fail
index e6720cf67b933398d181dcc4b1d9986a58508669..8b5a22c8a9fb6c807b5ddf0dc34438f0c8f24fa2 100644 (file)
@@ -39,7 +39,7 @@ if (diff != 60s) {
 #
 #  Cast the time delta to milliseconds
 #
-num = %cast("ms", %{diff})
+num = %cast("ms", diff)
 
 #
 #  This results in 60, because the conversion to fr_value_box_cast() doesn't pass dst->enumv?
index 1f6a81da9750e0c3207de792fb49fe2cf5ed453f..2c30e3104488b5b4b58325097b8339703bec67b3 100644 (file)
@@ -1,7 +1,10 @@
 octets cbor
 string foo
 
-cbor = %cbor.encode(User-Name)
+#
+#  @todo - this should be a dcursor
+#
+cbor = %cbor.encode('User-Name')
 
 #
 #  9f          array of indefinite length
@@ -28,7 +31,7 @@ if (User-Name) {
 #
 #  @todo - change this to be configurable :(
 #
-%cbor.decode(%{cbor})
+%cbor.decode(cbor)
 
 if (User-Name != "bob") {
        test_fail
index 9fd60e946feb564273795f80660fe9c63c045d27..a00d3d39036d724725395cd14ecfac054b979a93 100644 (file)
@@ -3,7 +3,7 @@
 #
 #      {} == {} --> true
 #
-if !(%test.fail() == %test.fail()) {
+if (%test.fail() != %test.fail()) {
        test_fail
 }
 
index aee33ed521ed4212a43041d9dc1b9518b2b0de00..4e433cc28af82da65b7ec90ba6634b58d9726c1e 100644 (file)
@@ -11,7 +11,7 @@ date test_date
 test_integer := 1506101100
 
 # Convert to string representation
-result_string1 := %date(%{test_integer})
+result_string1 := %date(test_integer)
 
 # Some systems report GMT some UTC...
 if (!(result_string1 == "Fri 22 Sep 17:25:00 GMT 2017")) && (!(result_string1 == "Fri 22 Sep 17:25:00 UTC 2017")) {
@@ -19,7 +19,7 @@ if (!(result_string1 == "Fri 22 Sep 17:25:00 GMT 2017")) && (!(result_string1 ==
 }
 
 # Convert string to integer
-result_integer := %date(%{result_string1})
+result_integer := %date(result_string1)
 
 
 if (!(result_integer == test_integer)) {
@@ -27,7 +27,7 @@ if (!(result_integer == test_integer)) {
 }
 
 # Compare two methods of reading request timestamp in local timezone
-result_string1 := %localdate(request)
+result_string1 := %localdate('request')
 result_string2 := %S
 
 if (!(result_string1 == result_string2)) {
@@ -37,7 +37,7 @@ if (!(result_string1 == result_string2)) {
 # Convert different string format
 result_string1 := "2017-09-22 17:25:00"
 
-result_integer := %sqldate(%{result_string1})
+result_integer := %sqldate(result_string1)
 
 if (!(result_integer == test_integer)) {
        test_fail
@@ -45,7 +45,7 @@ if (!(result_integer == test_integer)) {
 
 # Use a date attribute
 test_date := 1659985459
-result_string1 := %sqldate(%{test_date})
+result_string1 := %sqldate(test_date)
 
 if !(result_string1 == '2022-08-08 19:04:19') {
        test_fail
@@ -53,7 +53,7 @@ if !(result_string1 == '2022-08-08 19:04:19') {
 
 # Invalid format
 result_string1 := '201-32-22 17:25:00'
-result_string2 := %sqldate(%{result_string1})
+result_string2 := %sqldate(result_string1)
 
 # This shouldn't exist, as the RHS above is NULL, and therefore the assignment will fail
 if (result_string2) {
@@ -66,7 +66,7 @@ if (!(Module-Failure-Message == "Failed to parse time string \"201-32-22 17:25:0
 
 # Invalid type
 NAS-IP-Address := "192.168.1.1"
-result_string2 := %date(%{NAS-IP-Address})
+result_string2 := %date(NAS-IP-Address)
 
 if (result_string2) {
        test_fail
index 788b99fafe5627ed719a8ba8bc0f00704439e2b9..196f24ba8f6147684de5815b8ebafbd5a23a4f2f 100644 (file)
@@ -12,12 +12,12 @@ if (!(%debug(3) == 4)) {
 }
 
 # Call with NULL arg, should report current level
-if (!(%debug(%{dummy_string}) == 3)) {
+if (!(%debug(dummy_string) == 3)) {
        test_fail
 }
 
 # ...and again
-if (!(%debug(%{dummy_string}) == 3)) {
+if (!(%debug(dummy_string) == 3)) {
        test_fail
 }
 
index afa41fad6bc084bedfc77c24f5fc067acf1e1f93..3243c8334094dabd279b61355ecd628b8bf1a50f 100644 (file)
@@ -3,7 +3,7 @@ uint32 foo
 Tmp-Integer-0 := 1
 Tmp-Integer-1 := { 3, 6, 9 }
 
-foo = %eval(%{'%{Tmp-Integer-1[' + "%{Tmp-Integer-0}" + ']}'})
+foo = %eval('%{Tmp-Integer-1[' + "%{Tmp-Integer-0}" + ']}')
 
 if (foo != 6) {
        test_fail
index 56c4714ceae98acd4981a90756042f5cb6a6bac1..d38ea9efbc4f32edcbe22c516a502cac0d2edc43 100644 (file)
@@ -7,7 +7,7 @@ baz = "a,b,c,d,e"
 #
 #  Append, don't create multiple versions
 #
-bar += %explode(%{baz}, ',')
+bar += %explode(baz, ',')
 
 if !(bar == "abcde") {
        test_fail
@@ -19,7 +19,7 @@ if !(bar == "abcde") {
 #  We cannot have multiple copies of local variables.  There's no real
 #  reason why, but for now it's safer to be limited.
 #
-foo := %explode(%{baz}, ',')
+foo := %explode(baz, ',')
 if !(foo[#] == 1) {
        test_fail
 }
index 233f532aa17df2fc6908b025e054bf81c604438e..6de1c95873fb69324402ccfe07c65430e5769742 100644 (file)
@@ -25,39 +25,39 @@ test_string8 := 'Å’=C4=8Cÿ'
 # = not followed by hex and without 2 following chars
 test_string9 := 'a=Az=y'
 
-if (!((string)%escape.escape("%{test_string1}") == test_string1)) {
+if (!((string)%escape.escape(test_string1) == test_string1)) {
        test_fail
 }
 
-if (!((string)%escape.escape("%{test_string2}") == test_string4)) {
+if (!((string)%escape.escape(test_string2) == test_string4)) {
        test_fail
 }
 
-if (!((string)%escape.escape("%{test_string3}") == test_string5)) {
+if (!((string)%escape.escape(test_string3) == test_string5)) {
        test_fail
 }
 
-if (!((string)%escape.unescape("%{test_string1}") == test_string1)) {
+if (!((string)%escape.unescape(test_string1) == test_string1)) {
        test_fail
 }
 
-if (!((string)%escape.unescape("%{test_string4}") == "%{test_string2}")) {
+if (!((string)%escape.unescape(test_string4) == test_string2)) {
        test_fail
 }
 
-if (!((string)%escape.unescape("%{test_string5}") == test_string3)) {
+if (!((string)%escape.unescape(test_string5) == test_string3)) {
        test_fail
 }
 
-if (!((string)%escape.escape("%{test_string7}") == test_string8)) {
+if (!((string)%escape.escape(test_string7) == test_string8)) {
        test_fail
 }
 
-if (!((string)%escape.unescape("%{test_string8}") == test_string7)) {
+if (!((string)%escape.unescape(test_string8) == test_string7)) {
        test_fail
 }
 
-if (!((string)%escape.unescape("%{test_string9}") == test_string9)) {
+if (!((string)%escape.unescape(test_string9) == test_string9)) {
        test_fail
 }
 
index 6790f337a9fae90b1db1eff2cb10fef9520b6588..6249c066e3e6c91de6e6226996f6e5c8d6b3c9c7 100644 (file)
@@ -21,15 +21,15 @@ request += {
 }
 
 
-if (!(%length(%{Reply-Message}) == 39)) {
+if (%length(Reply-Message) != 39) {
        test_fail
 }
 
-if (!(%length(%{Callback-Number}) == 42)) {
+if (%length(Callback-Number) != 42) {
        test_fail
 }
 
-result_string := "%{(string) %{test_octets}}"
+result_string := "%{(string) test_octets}"
 if (!(result_string == "i have scary embedded things\000 inside me")) {
        test_fail
 }
@@ -44,11 +44,11 @@ if (!(result_string == "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°")) {
        test_fail
 }
 
-if (!("%{Reply-Message[0]}" == "i have scary embedded things\000 inside me")) {
+if ("%{Reply-Message[0]}" != "i have scary embedded things\000 inside me") {
        test_fail
 }
 
-if (!(Reply-Message[1] == "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°")) {
+if (Reply-Message[1] != "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°") {
        test_fail
 }
 
@@ -80,7 +80,7 @@ if (!(Callback-Id[1] == "0x01\0010x07\0070x0A\n0x0D\r''0xb0\260°")) {
 #  Other data types
 #
 result_string := "%{(string) test_ipaddr}"
-if (!(%length(%{result_string}) == 9)) {
+if (!(%length(result_string) == 9)) {
        test_fail
 }
 
index be3d605cddc1183c0feab518a653bccb24ec4fd1..772acbb270e089054ceeb48ce76fb98c35334d57 100644 (file)
@@ -1,5 +1,5 @@
 #
 #  We only care if this crashes or not.
 #
-Filter-Id := "%{1 + 1} %tolower(1)"
+Filter-Id := "%{1 + 1} %tolower('1')"
 success
index c089183628475a37622e46ae60033e0bb5c80086..2a1f66000c02e83156a78bc529b5b21951f58d56 100644 (file)
@@ -4,27 +4,20 @@
 
 Reply-Message := "bob\000hello"
 
+if %length(Reply-Message) != 9 {
+       test_fail
+}
+
 #
-#  Commented out because it fails
+#  This assignment grabs the first element of the list, and tosses the remaining ones.
 #
-#if %length("\000") != 1 {
-#      test_fail
-#}
-
-if Reply-Message {
-       group tmp
-       octets delim
+Reply-Message := %explode(Reply-Message, 0x00)
 
-       #
-       #  Because "\000" yields "zero length delimiter is not allowed"
-       #
-       delim = 0x00
-       tmp.Reply-Message := %explode(%{Reply-Message}, "%{delim}")
-
-       Reply-Message := tmp.Reply-Message[0]
+if Reply-Message != "bob" {
+       test_fail
 }
 
-if Reply-Message != "bob" {
+if %length(Reply-Message) != 3 {
        test_fail
 }
 
index ce4b1be9f32c288b1c8dc51e2ba09847344fa978..11e3147337a2ff4ebfa762613985dee70f5c9c89 100644 (file)
@@ -7,7 +7,7 @@ string result
 input = "a b c d e f"
 result = ""
 
-foreach string thing (%explode(%{input}, ' ')) {
+foreach string thing (%explode(input, ' ')) {
        result += thing
        result += ','
 }
index f48b7ca34499a964ce1938aa1951b170774b9a32..733fabf4c060174020f05085236a9e4895f3a191 100644 (file)
@@ -7,7 +7,7 @@ string result
 input = "a b c d e f"
 result = ""
 
-foreach uint32 key,string thing (%explode(%{input}, ' ')) {
+foreach uint32 key,string thing (%explode(input, ' ')) {
        result += thing
        result += ':'
        result += (string) key
index 09bcee68f356135cc8cbdeb4e9021357e69074ef..9d4318b45f6c44a232730e7afb5fe532e2b540f0 100644 (file)
@@ -14,7 +14,7 @@ Tmp-String-1 := { "a", "b", "c", "d" }
 foreach string key, string name (Tmp-String-0[*]) {
        total += key
        total += " = '"
-       total += %eval(%{"&" + %{key}})
+       total += %eval(key)
        total += "', "
 }
 
index c879116ce0ad9449206a07af78aa2c126b88affc..849b6aed412818b20aa61f32a47af692909a9dff 100644 (file)
@@ -30,73 +30,73 @@ test_int64          := 1152921505566832445
 test_ipv4prefix        := 57.56.55.62/32
 
 # String
-result_string := %hex(%{test_string})
+result_string := %hex(test_string)
 if (!(result_string == '39383730')) {
        test_fail
 }
 
 # Octets
-result_string := %hex(%{test_octets})
+result_string := %hex(test_octets)
 if (!(result_string == '39383731')) {
        test_fail
 }
 
 # IP Address
-result_string := %hex(%{test_ipaddr})
+result_string := %hex(test_ipaddr)
 if (!(result_string == '39383732')) {
        test_fail
 }
 
 # Integer
-result_string := %hex(%{test_integer})
+result_string := %hex(test_integer)
 if (!(result_string == '39383734')) {
        test_fail
 }
 
 # ifid
-result_string := %hex(%{test_ifid})
+result_string := %hex(test_ifid)
 if (!(result_string == '0000000039383737')) {
        test_fail
 }
 
 # ipv6addr
-result_string := %hex(%{test_ipv6addr})
+result_string := %hex(test_ipv6addr)
 if (!(result_string == '00000000000000000000000039383738')) {
        test_fail
 }
 
 # ipv6addrprefix
-result_string := %hex(%{test_ipv6prefix})
+result_string := %hex(test_ipv6prefix)
 if (!(result_string == '008000000000000000000000000039383739')) {
        test_fail
 }
 
 # byte
-result_string := %hex(%{test_byte})
+result_string := %hex(test_byte)
 if (!(result_string == '3a')) {
        test_fail
 }
 
 # short
-result_string := %hex(%{test_short})
+result_string := %hex(test_short)
 if (!(result_string == '373b')) {
        test_fail
 }
 
 # ethernet
-result_string := %hex(%{test_ether})
+result_string := %hex(test_ether)
 if (!(result_string == '00003938373c')) {
        test_fail
 }
 
 # integer64
-result_string := %hex(%{test_int64})
+result_string := %hex(test_int64)
 if (!(result_string == '100000003938373d')) {
        test_fail
 }
 
 # ipv4prefix
-result_string := %hex(%{test_ipv4prefix})
+result_string := %hex(test_ipv4prefix)
 if (!(result_string == '203938373e')) {
        test_fail
 }
@@ -107,7 +107,7 @@ request += {
        Class = 0x0405
 }
 
-NAS-Identifier := %hex(%{Class[*]})
+NAS-Identifier := %hex(Class[*])
 
 if (NAS-Identifier[#] != 3) {
        test_fail
index 568af21a1f6c3ead20d21eb3ea2de157626fbdd1..79b70d84c95dd1d181b5d9b20a43932791cc2444 100644 (file)
@@ -6,7 +6,7 @@ if (('${feature.regex-pcre}' == 'yes') || ('${feature.regex-pcre2}' == 'yes')) {
 
 # Check failure when no previous capture - named group
 # but a failed regex is equivalent to an empty string
-if (%regex(foo)) {
+if (%regex('foo')) {
        test_fail
 }
 
index 1cbfb218aee6097e1bff90e31ceb37261fb5128e..52f25137d1b258e7de7caea4b65392984a1dcc92 100644 (file)
@@ -21,7 +21,7 @@ if (!(Module-Failure-Message[*] == "No previous regex capture")) {
 request -= Module-Failure-Message[*]
 
 # Check failure when no previous capture - named group
-if (%regex(foo)) {
+if (%regex('foo')) {
        test_fail
 }
 
@@ -32,7 +32,7 @@ if (!(Module-Failure-Message[*] == "No previous named regex capture group")) {
 request -= Module-Failure-Message[*]
 
 # Check failure when no previous capture - numbered group
-if (%regex(%{Port-Limit})) {
+if (%regex(Port-Limit)) {
        test_fail
 }
 
@@ -44,7 +44,7 @@ request -= Module-Failure-Message[*]
 
 # uncompiled - ref - named capture groups
 if (User-Name =~ /^(?<one>[0-9])_(?<two>[0-9])?_(?<three>[0-9]*)_(?<four>[0-9]+)_(?<five>[^_])_(?<six>6)_(?<seven>[7-8])%{dummy_string}/) {
-       result_string := "%regex(seven)_%regex(six)_%regex(five)_%regex(four)_%regex(three)_%regex(two)_%regex(one)_%{0}"
+       result_string := "%regex('seven')_%regex('six')_%regex('five')_%regex('four')_%regex('three')_%regex('two')_%regex('one')_%{0}"
        if (!(result_string == '7_6_5_4_3_2_1_1_2_3_4_5_6_7')) {
                test_fail
        }
@@ -55,7 +55,7 @@ else {
 
 # Checking capture groups are cleared out correctly
 if (User-Name =~ /^(?<one>[0-9])_%{dummy_string}/) {
-       result_string := "%{0}%regex(one)%regex(two)%regex(three)%regex(four)%regex(five)%regex(six)%regex(seven)"
+       result_string := "%{0}%regex('one')%regex('two')%regex('three')%regex('four')%regex('five')%regex('six')%regex('seven')"
        if (!(result_string == '1_1')) {
                test_fail
        }
@@ -66,7 +66,7 @@ else {
 
 # Checking capture groups are cleared out correctly when there are no matches
 if (User-Name =~ /^.%{dummy_string}/) {
-       result_string := "%{0}%regex(one)%regex(two)%regex(three)%regex(four)%regex(five)%regex(six)%regex(seven)"
+       result_string := "%{0}%regex('one')%regex('two')%regex('three')%regex('four')%regex('five')%regex('six')%regex('seven')"
        if (!(result_string == '1')) {
                test_fail
        }
@@ -77,7 +77,7 @@ else {
 
 # compiled - ref - named capture groups
 if (User-Name =~ /^(?<one>[0-9])_(?<two>[0-9])?_(?<three>[0-9]*)_(?<four>[0-9]+)_(?<five>[^_])_(?<six>6)_(?<seven>[7-8])/) {
-       result_string := "%regex(seven)_%regex(six)_%regex(five)_%regex(four)_%regex(three)_%regex(two)_%regex(one)_%{0}"
+       result_string := "%regex('seven')_%regex('six')_%regex('five')_%regex('four')_%regex('three')_%regex('two')_%regex('one')_%{0}"
        if (!(result_string == '7_6_5_4_3_2_1_1_2_3_4_5_6_7')) {
                test_fail
        }
@@ -88,7 +88,7 @@ else {
 
 # compiled - xlat - named capture groups
 if ('1_2_3_4_5_6_7' =~ /^(?<one>[0-9])_(?<two>[0-9])?_(?<three>[0-9]*)_(?<four>[0-9]+)_(?<five>[^_])_(?<six>6)_(?<seven>[7-8])/) {
-       result_string := "%regex(seven)_%regex(six)_%regex(five)_%regex(four)_%regex(three)_%regex(two)_%regex(one)_%{0}"
+       result_string := "%regex('seven')_%regex('six')_%regex('five')_%regex('four')_%regex('three')_%regex('two')_%regex('one')_%{0}"
        if (!(result_string == '7_6_5_4_3_2_1_1_2_3_4_5_6_7')) {
                test_fail
        }
@@ -128,7 +128,7 @@ if (User-Name =~ /^(?<one>[0-9])_(?<two>[0-9])?_(?<three>[0-9]*)_(?<four>[0-9]+)
        g := 6
        h := 7
 
-       result_string := "%regex(%{h})_%regex(%{g})_%regex(%{f})_%regex(%{e})_%regex(%{d})_%regex(%{c})_%regex(%{b})_%regex(%{a})"
+       result_string := "%regex(h)_%regex(g)_%regex(f)_%regex(e)_%regex(d)_%regex(c)_%regex(b)_%regex(a)"
        if (!(result_string == '7_6_5_4_3_2_1_1_2_3_4_5_6_7')) {
                test_fail
        }
index 52358a9e9f17fb59cbf359c2a3f962428b7d752a..d9bee1eb56a4192c32550241644ba5ceb773d46b 100644 (file)
@@ -30,7 +30,7 @@ else {
 if (true) {
        ok
 }
-elsif ("%foo(bar)") {  # no pass2
+elsif ("%foo('bar')") {        # no pass2
        no-such-module
 }
 else {
index be5fb36701728dbdf9611ee31443c10c9c9c3ae5..3f7dfe845a8017305926aac3c9fa363835b9c9b7 100644 (file)
@@ -4,7 +4,7 @@
 
 %map("TLS-Certificate.Issuer = 'foo'")
 
-if !(TLS-Certificate.Issuer == 'foo') {
+if TLS-Certificate.Issuer != 'foo' {
        test_fail
 }
 
index eb0d795dc0ca522a05643fa77b94397e3c86651e..f83cb902b33cb2b285e5463aec3892dd8aaf0cbf 100644 (file)
@@ -18,7 +18,7 @@ if !(NAS-Port == 1813) {
 #
 #  Mark it as immutable.  The value shouldn't change.
 #
-%immutable(request.NAS-Port[*])
+%immutable('request.NAS-Port[*]')
 if !(NAS-Port == 1813) {
        test_fail
 }
index 9d0df2bb4280394cd09e43071a1f75ddf55ffb96..6b8288b0237dda3ba9e9c2b11f62ffed7251d21a 100644 (file)
@@ -30,13 +30,13 @@ debug_request
 #
 #  @todo - fix this...
 #
-result_string := %concat(%join(%{control.[*]}, %{request.Framed-IP-Address}), '. ')
+result_string := %concat(%join(%{control.[*]}, request.Framed-IP-Address), '. ')
 
 if (!(result_string == "bob. hello. ab c. de fg. 123. 192.168.1.254")) {
        test_fail
 }
 
-result_string := %concat(%join(%{control.Filter-Id[*]}, %{control.NAS-Port}), ',')
+result_string := %concat(%join(control.Filter-Id[*], control.NAS-Port), ',')
 if (!(result_string == "ab c,de fg,123")) {
        test_fail
 }
index ab258c205ee9f9d23e321b98427315a86d30be38..77a563e0ef14c2b649a812819220e35cddd603b0 100644 (file)
@@ -20,7 +20,7 @@ abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab
 abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\
 abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'
 
-if (!(%length(%{test_string}) == 260)) {
+if (%length(test_string) != 260) {
        test_fail
 }
 
@@ -38,19 +38,19 @@ test_int64 := 1152921505566832445
 test_ipv4prefix := 57.56.55.62/32
 
 # String - bin 0x39383730
-result_int := %length(%{test_string})
-if (!(result_int == 4)) {
+result_int := %length(test_string)
+if (result_int != 4) {
        test_fail
 }
 
 # Octets - bin 0x39383731
-result_int := %length(%{test_octets})
+result_int := %length(test_octets)
 if (!(result_int == 4)) {
        test_fail
 }
 
 # IP Address - bin 0x39383732
-result_int := %length(%{test_ipaddr})
+result_int := %length(test_ipaddr)
 if (!(result_int == 4)) {
        test_fail
 }
@@ -62,55 +62,55 @@ if (!(result_int == 12)) {
 }
 
 # Integer - bin 0x39383734
-result_int := %length(%{test_integer})
+result_int := %length(test_integer)
 if (!(result_int == 4)) {
        test_fail
 }
 
 # ifid - bin 0x0000000039383737
-result_int := %length(%{test_ifid})
+result_int := %length(test_ifid)
 if (!(result_int == 8)) {
        test_fail
 }
 
 # ipv6addr - bin 0x00000000000000000000000039383738
-result_int := %length(%{test_ipv6addr})
+result_int := %length(test_ipv6addr)
 if (!(result_int == 16)) {
        test_fail
 }
 
 # ipv6addrprefix - bin 0x8000000000000000000000000039383739
-result_int := %length(%{test_ipv6prefix})
+result_int := %length(test_ipv6prefix)
 if (!(result_int == 17)) {
        test_fail
 }
 
 # byte - bin 0x3a
-result_int := %length(%{test_byte})
+result_int := %length(test_byte)
 if (!(result_int == 1)) {
        test_fail
 }
 
 # short - bin 0x373b
-result_int := %length(%{test_short})
+result_int := %length(test_short)
 if (!(result_int == 2)) {
        test_fail
 }
 
 # ethernet - bin 0x00003938373c
-result_int := %length(%{test_ether})
+result_int := %length(test_ether)
 if (!(result_int == 6)) {
        test_fail
 }
 
 # integer64 - bin 0x100000003938373d
-result_int := %length(%{test_int64})
+result_int := %length(test_int64)
 if (!(result_int == 8)) {
        test_fail
 }
 
 # ipv4prefix - bin 0x203938373e
-result_int := %length(%{test_ipv4prefix})
+result_int := %length(test_ipv4prefix)
 if (!(result_int == 5)) {
        test_fail
 }
index a240d702afab9c614ce173ec5fe5e9bd1e1d06da..4a5659d064ebacc5efe5d12b0393ef1c96f59933 100644 (file)
@@ -15,41 +15,41 @@ request += {
        Vendor-Specific.Microsoft.CHAP-Response = 0x00010000000000000000000000000000000000000000000000008860bbaac0cd3960b4ce5dc6f0f7a462b897ef530484e80f
 }
 
-result_octets := %mschap(Challenge)
+result_octets := %mschap('Challenge')
 if !(result_octets == 0xe96e4fff2955c4f1) {
        test_fail
 }
 
-result_octets := %mschap(NT-Response)
+result_octets := %mschap('NT-Response')
 if !(result_octets == 0x8860bbaac0cd3960b4ce5dc6f0f7a462b897ef530484e80f) {
        test_fail
 }
 
-result_string := %mschap(NT-Domain)
+result_string := %mschap('NT-Domain')
 if !(result_string == 'EXAMPLE') {
        test_fail
 }
 
-result_string := %mschap(User-Name)
+result_string := %mschap('User-Name')
 if !(result_string == 'bob') {
        test_fail
 }
 
 request.Vendor-Specific.Microsoft.CHAP-Response := 0x00006937d7935bb28a4c1dafe6a193bdea7a853a74d8bcf6db158860bbaac0cd3960b4ce5dc6f0f7a462b897ef530484e80f
 
-result_octets := %mschap(LM-Response)
+result_octets := %mschap('LM-Response')
 
 if !(result_octets == 0x6937d7935bb28a4c1dafe6a193bdea7a853a74d8bcf6db15) {
        test_fail
 }
 
 # Hashing
-result_octets := %mschap(NT-Hash, 'testing_123')
+result_octets := %mschap('NT-Hash', 'testing_123')
 if !(result_octets == 0xfa782604f85eb3564f555648341b53e4) {
        test_fail
 }
 
-result_octets := %mschap(LM-Hash, 'testing_123')
+result_octets := %mschap('LM-Hash', 'testing_123')
 if !(result_octets == 0x2d5545077d7b7d2ae4343f96ab15c596) {
        test_fail
 }
@@ -60,19 +60,19 @@ request -= Vendor-Specific.Microsoft.CHAP-Response[*]
 Vendor-Specific.Microsoft.CHAP-Challenge := 0x04408dc2a98dae1ce351dfc53f57d08e
 Vendor-Specific.Microsoft.CHAP2-Response := 0x00010e93cfbfcef8d5b6af42d2b2ca5b43180000000000000000bc068d1e8c54de5e9db78e6736d686eb88a999dd7fa239b200
 
-result_octets := %mschap(Challenge)
+result_octets := %mschap('Challenge')
 if !(result_octets == 0xad18b6b8e1478b4c) {
        test_fail
 }
 
-result_octets := %mschap(NT-Response)
+result_octets := %mschap('NT-Response')
 if !(result_octets == 0xbc068d1e8c54de5e9db78e6736d686eb88a999dd7fa239b2) {
        test_fail
 }
 
 # Invalid
 Vendor-Specific.Microsoft.CHAP-Challenge := 0xf0eac4151d5346662ba8c5e428
-result_string := %mschap(Challenge)
+result_string := %mschap('Challenge')
 
 if (result_string) {
        test_fail
index a044cac822604015322f79f7a008ac965c2988ba..9ab47cc3857b1c89f5f5cf70b82d2297242bbe71 100644 (file)
@@ -8,7 +8,7 @@ uint32 result_integer
 #  different numbers of days involved.  Check hour / day / week
 #
 
-result_integer := "%{%nexttime(2h) - %nexttime(1h)}"
+result_integer := "%{%nexttime('2h') - %nexttime('1h')}"
 
 # We have a fudge factor of 1 second either way
 if ((result_integer < 3599) || (result_integer > 3601)) {
@@ -18,7 +18,7 @@ if ((result_integer < 3599) || (result_integer > 3601)) {
 #
 #  Day
 #
-result_integer := "%{%nexttime(3d) - %nexttime(1d)}"
+result_integer := "%{%nexttime('3d') - %nexttime('1d')}"
 if ((result_integer < 172799) || (result_integer > 172801)) {
        test_fail
 }
@@ -26,7 +26,7 @@ if ((result_integer < 172799) || (result_integer > 172801)) {
 #
 #  Week
 #
-result_integer := "%{%nexttime(4w) - %nexttime(2w)}"
+result_integer := "%{%nexttime('4w') - %nexttime('2w')}"
 if ((result_integer < 1209599) || (result_integer > 1209601)) {
        test_fail
 }
index 9d358f0e1a7b1b40f5e2e0276ca9fbc1b50ef286..18993fb505eb07f2a66ced66dca51e80663d6303 100644 (file)
@@ -27,17 +27,17 @@ Tmp-Group-0 += {
 #
 #pairs := %cast('string', %{Tmp-Group-0.[*]})
 
-result_string := "%concat(%pairs(Tmp-Group-0.[*]), ', ')"
+result_string := "%concat(%pairs('Tmp-Group-0.[*]'), ', ')"
 if !(result_string == 'Filter-Id = "This is a string", Filter-Id = "This is another one", Class = 0x000504030201, NAS-Port = 7331') {
        test_fail
 }
 
-result_string := "%pairs(Tmp-Group-0.Filter-Id)"
+result_string := "%pairs('Tmp-Group-0.Filter-Id')"
 if !(result_string == 'Filter-Id = "This is a string"') {
        test_fail
 }
 
-result_string := "%concat(%pairs(Tmp-Group-0.Filter-Id[*]), ', ')"
+result_string := "%concat(%pairs('Tmp-Group-0.Filter-Id[*]'), ', ')"
 if !(result_string == 'Filter-Id = "This is a string", Filter-Id = "This is another one"') {
        test_fail
 }
@@ -45,17 +45,17 @@ if !(result_string == 'Filter-Id = "This is a string", Filter-Id = "This is anot
 #
 #  Must be nested
 #
-result_string := "%concat(%pairs(control.[*]), ', ')"
+result_string := "%concat(%pairs('control.[*]'), ', ')"
 if !(result_string == 'Password = { Cleartext = "hello" }') {
        test_fail
 }
 
-result_string := "%pairs(control.User-Name)"
+result_string := "%pairs('control.User-Name')"
 if (!(result_string == '')) {
        test_fail
 }
 
-result_string := "%pairs(request.Tmp-Group-0)"
+result_string := "%pairs('request.Tmp-Group-0')"
 if !(result_string == 'Tmp-Group-0 = { Filter-Id = "This is a string", Filter-Id = "This is another one", Class = 0x000504030201, NAS-Port = 7331 }') {
        test_fail
 }
index a8598d3c641bd7218eb0b4d77dd4307478a34258..f2613c8edea1c3143d33743733fda2eed5a74bf5 100644 (file)
@@ -3,7 +3,7 @@ string result_string
 #
 #  Empty output on empty input
 #
-result_string := "%randstr(%{result_string})"
+result_string := "%randstr(result_string)"
 if !(result_string == "") {
        test_fail
 }
@@ -11,27 +11,27 @@ if !(result_string == "") {
 #
 #  Check length of output
 #
-result_string := "%randstr(nnn)"
-if (!(%length(%{result_string}) == 3)) {
+result_string := "%randstr('nnn')"
+if (!(%length(result_string) == 3)) {
        test_fail
 }
 
-result_string := "%randstr(24a)"
-if (!(%length(%{result_string}) == 24)) {
+result_string := %randstr('24a')
+if (!(%length(result_string) == 24)) {
        test_fail
 }
 #
 #  Check maximum repetition
 #
-result_string := "%randstr(1030aa)"
-if (!(%length(%{result_string}) == 1025)) {
+result_string := %randstr('1030aa')
+if (!(%length(result_string) == 1025)) {
        test_fail
 }
 
 #
 #  Check invalid character class
 #
-result_string := "%randstr(G)"
+result_string := %randstr('G')
 
 if !(result_string == "") {
        test_fail
@@ -40,8 +40,8 @@ if !(result_string == "") {
 #
 #  Check repetition of binary output
 #
-result_string := "%randstr(10b)"
-if (!(%length(%{result_string}) == 10)) {
+result_string := %randstr('10b')
+if (!(%length(result_string) == 10)) {
        test_fail
 }
 
index 807c2032decea0f159f62061f8058205425f2cfc..c41e2b495e01ef2d6d610cafe325d6b9ed88bf39 100644 (file)
@@ -10,7 +10,7 @@ bool c
 #
 redundant {
        timeout 0.01s {
-               a := %delay_10s(0.1)
+               a := %delay_10s(0.1s)
                test_fail
        }
 
@@ -21,7 +21,7 @@ redundant {
 
 redundant {
        timeout "0.01" {
-               a := %delay_10s(0.1)
+               a := %delay_10s(0.1s)
                test_fail
        }
 
index 7e47924da5c666d53be361a678c0b19af8460bc6..175f082fa66553d1da4a8bf17f959f58c3bddd23 100644 (file)
@@ -5,13 +5,13 @@ string test_string
 string dummy_string
 
 test_string    := "AbCdE"
-test_string    := %tolower(%{test_string})
+test_string    := %tolower(test_string)
 
 if !(test_string == "abcde") {
        test_fail
 }
 
-test_string    := %tolower(AAbbCCdd)
+test_string    := %tolower('AAbbCCdd')
 if !(test_string == "aabbccdd") {
        test_fail
 }
@@ -19,7 +19,7 @@ if !(test_string == "aabbccdd") {
 #
 #  Doesn't exist
 #
-test_string    := "%tolower(%{dummy_string})"
+test_string    := "%tolower(dummy_string)"
 if !(test_string == "") {
        test_fail
 }
index 9a4ba40873debb70d1b0fc28ca0260e6ec3ebf79..dfccc039c9a3472190a5234b80957994dc4976e0 100644 (file)
@@ -5,17 +5,17 @@ string test_string
 string dummy_string
 
 test_string    := "AbCdE"
-test_string    := %toupper(%{test_string})
+test_string    := %toupper(test_string)
 if (!(test_string == "ABCDE")) {
        test_fail
 }
 
-test_string    := %toupper(AAbbCCdd)
+test_string    := %toupper('AAbbCCdd')
 if (!(test_string == "AABBCCDD")) {
        test_fail
 }
 
-test_string    := "%toupper(%{dummy_string})"
+test_string    := "%toupper(dummy_string)"
 if !(test_string == "") {
        test_fail
 }
diff --git a/src/tests/keywords/xlat-arg-missing b/src/tests/keywords/xlat-arg-missing
new file mode 100644 (file)
index 0000000..f506c92
--- /dev/null
@@ -0,0 +1,3 @@
+bool foo
+
+foo := %file.exists() # ERROR
index f6d891fad6c275e8d35e368820a2dbfcf22dd849..0998b4ca2fdfc2f7db324dd4324f45ef4d506571 100644 (file)
@@ -4,13 +4,13 @@
 string result_string
 uint32 result_integer
 
-result_string := "%config(modules.static.test.boolean)"
+result_string := "%config('modules.static.test.boolean')"
 if (!(result_string == "no")) {
        test_fail
 }
 
 result_string := "test"
-result_integer := %config(modules.static.%{result_string}.integer)
+result_integer := %config("modules.static.%{result_string}.integer")
 if (!(result_integer == 1)) {
        test_fail
 }
index 5afad94480e96d56ae424a5a4f29c9b68ee8393c..2a7db434b5a24bfacecd83a664f1045f8c5f39fd 100644 (file)
@@ -1,21 +1,21 @@
 #
 # PRE: update
 #
-float32 result_float
+time_delta result
 
 # This is mainly a smoke test... i.e. if it crashes there's smoke
 
 %delay_10s()   # Should 'blip' the request
 
-result_float := %delay_10s(0.1)
-if (!result_float) {
+result := %delay_10s(0.1s)
+if (!result) {
        fail
 }
 
 #
 # Check the delay was ~100ms
 #
-if (result_float < 0.1) {
+if ((result < 0.1s) || (result > 0.2s)) {
        fail
 }
 
index 31e5c128364a0202fc338f901f51b8fbfa5ae095..0996f91f95b68e2676a9ba98e3134a1d64aa1c3e 100644 (file)
@@ -6,7 +6,7 @@ octets test_octets
 test_octets := 0x520d0103abcdef0206010203040506
 
 # the protocol decoder puts the attributes into a flat namespace
-if (!(%dhcpv4.decode(%{test_octets}) == 1)) {
+if (!(%dhcpv4.decode(test_octets) == 1)) {
        test_fail
 }
 
@@ -21,7 +21,7 @@ if !(Relay-Agent-Information.Remote-Id == 0x010203040506) {
 #
 #  Encode all of the Relay-Agent-Information suboptions
 #
-test_octets := %dhcpv4.encode(request.Relay-Agent-Information.[*])
+test_octets := %dhcpv4.encode('request.Relay-Agent-Information.[*]')
 
 if !(test_octets == 0x520d0103abcdef0206010203040506) {
        test_fail
@@ -31,7 +31,7 @@ if !(test_octets == 0x520d0103abcdef0206010203040506) {
 #  Check decoding and encoding of VSAs
 #
 test_octets := 0x7d1900002458140101010204c0a80101050968656c6c6f2e62696e
-if !(%dhcpv4.decode(%{test_octets}) == 1) {
+if !(%dhcpv4.decode(test_octets) == 1) {
        test_fail
 }
 
@@ -39,13 +39,13 @@ if (V-I-Vendor-Specific.CTS.Firmware-File-Name != 'hello.bin') {
        test_fail
 }
 
-test_octets := %dhcpv4.encode(V-I-Vendor-Specific)
+test_octets := %dhcpv4.encode('V-I-Vendor-Specific')
 
 if (test_octets != 0x7d1900002458140101010204c0a80101050968656c6c6f2e62696e) {
        test_fail
 }
 
-test_octets := %dhcpv4.encode(V-I-Vendor-Specific.CTS.[*])
+test_octets := %dhcpv4.encode('V-I-Vendor-Specific.CTS.[*]')
 if (test_octets != 0x7d1900002458140101010204c0a80101050968656c6c6f2e62696e) {
        test_fail
 }
index 8a5a81c0cfdd1e25d842d6e80ad6d5f4638cbd4c..0586034eb8a606f6e0a57735d4424345c478728e 100644 (file)
@@ -8,7 +8,7 @@ if !("\%{ FOO}" == '%{ FOO}') {
        test_fail
 }
 
-if !(%tolower(\%{FOO}) == '%{foo}') {
+if !(%tolower("\%{FOO}") == '%{foo}') {
        test_fail
 }
 
index 1581e82910e087984e459d9922fa94bddb349b6e..ed710db99ce12720a4d709eec0abcc73531706c5 100644 (file)
@@ -17,27 +17,27 @@ control += {
        Filter-Id = 'here.  are . some.  words. '
 }
 
-result_string := "%concat(%explode(%{Class}, '|'), ',')"
+result_string := "%concat(%explode(Class, '|'), ',')"
 if (!(result_string == "1=1,my_attr=2,my_attr=hello")) {
        test_fail
 }
 
-result_string := "%concat(%explode(%{Calling-Station-ID}, '|'), ',')"
+result_string := "%concat(%explode(Calling-Station-ID, '|'), ',')"
 if (!(result_string == "")) {
        test_fail
 }
 
-result_string := "%concat(%explode(%{control.User-Name[*]}, |), ',')"
+result_string := "%concat(%explode(control.User-Name[*], '|'), ',')"
 if (!(result_string == "hello,goodbye,morning,night,1")) {
        test_fail
 }
 
-result_string := "%concat(%explode(%{control.Reply-Message}, |), ',')"
+result_string := "%concat(%explode(control.Reply-Message, '|'), ',')"
 if !(result_string == 'Can\'t touch this') {
        test_fail
 }
 
-result_string := "%concat(%explode(%{control.Filter-Id}, '. '), ',')"
+result_string := "%concat(%explode(control.Filter-Id, '. '), ',')"
 if !(result_string == 'here, are ,some, words') {
        test_fail
 }
index 2cd14105834bfeda212471a79a704c34bc37a726..1063ef5b16c9f598decdf76c683be03ad7b124aa 100644 (file)
@@ -7,19 +7,19 @@
 string result_string
 uint32 result_integer
 
-result_string := "%interpreter(.filename)"
-result_integer := "%interpreter(.line)"
+result_string := "%interpreter('.filename')"
+result_integer := "%interpreter('.line')"
 
 if (!(result_string == "src/tests/keywords/xlat-interpreter")) {
        test_fail
 }
 
-result_string := "%interpreter(.name)"
+result_string := "%interpreter('.name')"
 if (!(result_string == "result_string")) {
        test_fail
 }
 
-result_string := "%interpreter(.type)"
+result_string := "%interpreter('.type')"
 if (!(result_string == "edit")) {
        test_fail
 }
index 5d84ae7b911ff1c60e09048f83a9d48e4f5189a9..907deaf01f7a4e687e6c5eb9dcb63a5ae468fc9e 100644 (file)
@@ -2,18 +2,18 @@
 #
 #  PRE: if
 #
-if (!(%concat(%test1.passthrough(foo, bar),'|') == "foo|bar")) {
+if (%concat(%test1.passthrough('foo', 'bar'),'|') != "foo|bar") {
        test_fail
 }
 
-if (!(%concat(%test2.passthrough(foo, bar), '|') == "foo|bar")) {
+if (%concat(%test2.passthrough('foo', 'bar'), '|') != "foo|bar") {
        test_fail
 }
 
 #
 #  The config has a "redundant" block for test1 and test2.
 #
-if (!(%concat(%redundant_test.passthrough(foo, bar), '|') == "foo|bar")) {
+if (%concat(%redundant_test.passthrough('foo', 'bar'), '|') != "foo|bar") {
        test_fail
 }
 
index 3c63d2d058e1b98608de912f7378844396a30330..249e34e340a8606d52b7b054e1817f58f9fcfc5f 100644 (file)
@@ -13,78 +13,78 @@ empty_string := ''
 #
 
 # Global substitution
-if (!(%subst(%{test_string1}, 'a', 'b') == 'bbb')) {
+if (!(%subst(test_string1, 'a', 'b') == 'bbb')) {
        test_fail
 }
 
 # No match
-if (!(%subst(%{test_string1}, 'c', 'b') == 'aaa')) {
+if (!(%subst(test_string1, 'c', 'b') == 'aaa')) {
        test_fail
 }
 
 # Line ending rewrite
-if (!(%subst(%{test_string2}, "\n", "\r") == "\r\r\r")) {
+if (!(%subst(test_string2, "\n", "\r") == "\r\r\r")) {
        test_fail
 }
 
 # Removal
-if (!(%subst(%{test_string1}, 'a', '') == "")) {
+if (!(%subst(test_string1, 'a', '') == "")) {
        test_fail
 }
 
 # Removal of last word only
-if (!(%subst(%{test_string3}, 'dog', '') == "the quick brown fox jumped over the lazy ")) {
+if (!(%subst(test_string3, 'dog', '') == "the quick brown fox jumped over the lazy ")) {
        test_fail
 }
 
 # Removal of first and subsequent word
-if (!(%subst(%{test_string3}, 'the', '') == " quick brown fox jumped over  lazy dog")) {
+if (!(%subst(test_string3, 'the', '') == " quick brown fox jumped over  lazy dog")) {
        test_fail
 }
 
 # Removal of middle word
-if (!(%subst(%{test_string3}, 'jumped', '') == "the quick brown fox  over the lazy dog")) {
+if (!(%subst(test_string3, 'jumped', '') == "the quick brown fox  over the lazy dog")) {
        test_fail
 }
 
 # Replacement of last word only
-if (!(%subst(%{test_string3}, 'dog', 'cat') == "the quick brown fox jumped over the lazy cat")) {
+if (!(%subst(test_string3, 'dog', 'cat') == "the quick brown fox jumped over the lazy cat")) {
        test_fail
 }
 
 # Replacement of first and subsequent word
-if (!(%subst(%{test_string3}, 'the', 'cat') == "cat quick brown fox jumped over cat lazy dog")) {
+if (!(%subst(test_string3, 'the', 'cat') == "cat quick brown fox jumped over cat lazy dog")) {
        test_fail
 }
 
 # Replacement of middle word
-if (!(%subst(%{test_string3}, 'jumped', 'cat') == "the quick brown fox cat over the lazy dog")) {
+if (!(%subst(test_string3, 'jumped', 'cat') == "the quick brown fox cat over the lazy dog")) {
        test_fail
 }
 
 if ("${feature.regex-pcre2}" == 'yes') {
 # Basic substitutions
-if (!(%subst(%{test_string1}, /a/, 'b') == 'baa')) {
+if (!(%subst(test_string1, '/a/', 'b') == 'baa')) {
        test_fail
 }
 
 # Global substitution
-if (!(%subst(%{test_string1}, /a/g, 'b') == 'bbb')) {
+if (!(%subst(test_string1, '/a/g', 'b') == 'bbb')) {
        test_fail
 }
 
 # No match
-if (!(%subst(%{test_string1}, /z/, 'b') == 'aaa')) {
+if (!(%subst(test_string1, '/z/', 'b') == 'aaa')) {
        test_fail
 }
 
 # Basic substitutions - Dynamic
-if (!(%subst(%{test_string1}, /a%{empty_string}/, 'b') == 'baa')) {
+if (!(%subst(test_string1, "/a%{empty_string}/", 'b') == 'baa')) {
        test_fail
 }
 
 # Global substitution - Dynamic
-if (!(%subst(%{test_string1}, /a%{empty_string}/g, 'b') == 'bbb')) {
+if (!(%subst(test_string1, "/a%{empty_string}/g", 'b') == 'bbb')) {
        test_fail
 }
 
@@ -93,35 +93,35 @@ if (!(%subst(%{test_string1}, /a%{empty_string}/g, 'b') == 'bbb')) {
 #
 
 # Check that newlines really are newlines
-if (!(%length(%{test_string2}) == 3)) {
+if (!(%length(test_string2) == 3)) {
        test_fail
 }
 
 # Strip out just the first newline
-if (!(%subst(%{test_string2}, /^./s, '') == "\n\n")) {
+if (!(%subst(test_string2, '/^./s', '') == "\n\n")) {
        test_fail
 }
 
-if (!(%subst(%{test_string2}, /\n/, '') == "\n\n")) {
+if (!(%subst(test_string2, '/\n/', '') == "\n\n")) {
        test_fail
 }
 
 # Strip out all the newlines
-if (!(%subst(%{test_string2}, /\n/g, '') == '')) {
+if (!(%subst(test_string2, '/\n/g', '') == '')) {
        test_fail
 }
 
 # Line ending switch
-if (!(%subst(%{test_string2}, /\n/g, "\r") == "\r\r\r")) {
+if (!(%subst(test_string2, '/\n/g', "\r") == "\r\r\r")) {
        test_fail
 }
 
 # Capture groups
-if (!(%subst(%{test_string3}, '/^the (.*) brown (.*) jumped.*/', "$1,$2") == "quick,fox")) {
+if (!(%subst(test_string3, '/^the (.*) brown (.*) jumped.*/', "$1,$2") == "quick,fox")) {
        test_fail
 }
 
-if (!(%subst(%{test_string3}, "/^%{empty_string}the (.*) brown (.*) jumped.*/", "$1,$2") == "quick,fox")) {
+if (!(%subst(test_string3, "/^%{empty_string}the (.*) brown (.*) jumped.*/", "$1,$2") == "quick,fox")) {
        test_fail
 }