diff options
Diffstat (limited to '')
-rw-r--r-- | src/tests/keywords/escape-sequences | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/src/tests/keywords/escape-sequences b/src/tests/keywords/escape-sequences new file mode 100644 index 0000000..967656d --- /dev/null +++ b/src/tests/keywords/escape-sequences @@ -0,0 +1,95 @@ +# +# PRE: update if xlat-attr-index +# +update request { + control:Cleartext-Password := 'hello' + Tmp-Octets-0 := 0x69206861766520736361727920656d626564646564207468696e67730020696e73696465206d65 + Tmp-Octets-1 := 0x30783031013078303707307830410A307830440D222230786230b0C2b0 + Tmp-String-0 := "i have scary embedded things\000 inside me" + Tmp-String-0 += "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°" + + # and again with single quoted strings. + # unlike other languages, \r, \t, and \n have meaning inside of 'string' + Tmp-String-1 := 'i have scary embedded things\000 inside me' + Tmp-String-1 += '0x01\0010x07\0070x0A\n0x0D\r""0xb0\260°' + + Tmp-String-2 := 'i have scary embedded things\000 inside me' + Tmp-String-2 += "0x01\0010x07\0070x0A\n0x0D\r''0xb0\260°" + + reply:Filter-Id := "filter" +} + + +if ("%{length:&Tmp-String-0}" != 39) { + update reply { + Filter-Id += 'fail l-0' + } +} + +if ("%{length:&Tmp-String-1}" != 42) { + update reply { + Filter-Id += 'fail l-1' + } +} + +if ("%{string:Tmp-Octets-0}" != "i have scary embedded things\000 inside me") { + update reply { + Filter-Id += 'fail 1' + } +} + +if (&Tmp-String-0 != "i have scary embedded things\000 inside me") { + update reply { + Filter-Id += 'fail 2' + } +} + +if ("%{string:Tmp-Octets-1}" != "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°") { + update reply { + Filter-Id += 'fail 3' + } +} + +if ("%{Tmp-String-0[0]}" != "i have scary embedded things\000 inside me") { + update reply { + Filter-Id += 'fail 4' + } +} + +if ("%{Tmp-String-0[1]}" != "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°") { + update reply { + Filter-Id += 'fail 5' + } +} + +# And another slightly different codepath... +if ("%{Tmp-String-0[*]}" != "i have scary embedded things\000 inside me,0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°") { + update reply { + Filter-Id += 'fail 6' + } +} + +if (&Tmp-String-0[0] != &Tmp-String-0[0]) { + update reply { + Filter-Id += 'fail 7' + } +} + +# +# This seems weird... double escapes for most things, but single escapes +# for the quotation marks. +# +if ("%{Tmp-String-2[1]}" != "0x01\0010x07\0070x0A\n0x0D\r''0xb0\260°") { + update reply { + Filter-Id += 'fail 8' + } +} + +# +# And again as an attribute reference +# +if (&Tmp-String-2[1] != "0x01\0010x07\0070x0A\n0x0D\r''0xb0\260°") { + update reply { + Filter-Id += 'fail 9' + } +} |