aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2021-10-05 12:13:15 +0100
committerJoão Valverde <j@v6e.pt>2021-10-05 16:39:41 +0100
commitd45ba348fd12a058e8925bf08827eadc0d3c82b0 (patch)
treeb9cf646a4293f10a579ea12fad8189fac118eac1 /test
parentf7a2abb4ae20e44b93f47568fdb8e98bbd1ea5a8 (diff)
dfilter: Strengthen sanity check for range
Allow an entity in the grammar as range body. Perform a stronger sanity check during semantic analysis everywhere a range is used. This is both safer (unless we want to allow FIELD bodies only, but functions are allowed too) and also provides better error messages. Previously a range of range only compiled on the RHS. Now it can appear on both sides of a relation. This fixes a crash with STRING entities similar to #10690 for UNPARSED. This also adds back support for slicing functions that was removed in f3f833ccecce0e8611b2f1990d0fcf81959fcb78 (by accident presumably). Ping #10690
Diffstat (limited to 'test')
-rw-r--r--test/suite_dfilter/group_range_method.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/suite_dfilter/group_range_method.py b/test/suite_dfilter/group_range_method.py
index 4570171bb3..c3068a6ea0 100644
--- a/test/suite_dfilter/group_range_method.py
+++ b/test/suite_dfilter/group_range_method.py
@@ -34,3 +34,15 @@ class case_range(unittest.TestCase):
def test_slice_2_neg(self, checkDFilterCount):
dfilter = "ipx.src.node[3:2] == cc:dd"
checkDFilterCount(dfilter, 0)
+
+ def test_slice_string_1(self, checkDFilterFail):
+ dfilter = "frame == \"00\"[1]"
+ checkDFilterFail(dfilter, "Range is not supported for entity 00 of type STRING")
+
+ def test_slice_unparsed_1(self, checkDFilterFail):
+ dfilter = "a == b[1]"
+ checkDFilterFail(dfilter, "Range is not supported for entity b of type UNPARSED")
+
+ def test_slice_func_1(self, checkDFilterSucceed):
+ dfilter = "string(ipx.src.node)[3:2] == \"cc:dd\""
+ checkDFilterSucceed(dfilter)