summaryrefslogtreecommitdiffstats
path: root/tests/015
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-06-27 12:24:24 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-06-27 12:24:24 -0700
commit5d2ef0c1daf3d44db1acea0d201712a7b45875ea (patch)
treec853c1fb4a00bedf0b7aad097c6f5dab83e1f3e6 /tests/015
parent4649efb0b4eeb1515bc92711ecb65a2bce23d202 (diff)
downloadtxr-5d2ef0c1daf3d44db1acea0d201712a7b45875ea.tar.gz
txr-5d2ef0c1daf3d44db1acea0d201712a7b45875ea.tar.bz2
txr-5d2ef0c1daf3d44db1acea0d201712a7b45875ea.zip
regex-from-trie: correctly handle empty trie.
* filter.c (regex_from_trie): An empty trie matches nothing, so we must return the t regex syntax (match nothing), not nil (match empty string). A hash-based trie matches nothing if it is empty; but if it has user data, then it matches the empty string. * tests/015/trie.tl: Test cases added.
Diffstat (limited to 'tests/015')
-rw-r--r--tests/015/trie.tl4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/015/trie.tl b/tests/015/trie.tl
index de88a797..c145c060 100644
--- a/tests/015/trie.tl
+++ b/tests/015/trie.tl
@@ -52,3 +52,7 @@
(mvtest
(build (each ((d dat)) (add [rx1 d]))) dat
(build (each ((n ndt)) (add [rx1 n]))) (repeat '(nil) (len dat)))
+
+(mtest
+ (regex-from-trie (make-trie)) t
+ (regex-from-trie (trie-compress (make-trie))) t)