summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-07-15 14:30:29 -0300
committerEuAndreh <eu@euandre.org>2025-07-15 14:30:44 -0300
commit85aa454110656fdf3b93075bf687ad48294c1325 (patch)
treebca7245f5852cf366e8215300c6a175fd7f3fe93 /tests
parentsrc/paca.mjs (PRECEDENCE): Add "range" and "class" keys (diff)
downloadpaca-85aa454110656fdf3b93075bf687ad48294c1325.tar.gz
paca-85aa454110656fdf3b93075bf687ad48294c1325.tar.xz
tests/paca.mjs (test_compileNFA): Add test case for empty regex
Diffstat (limited to '')
-rw-r--r--tests/paca.mjs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/paca.mjs b/tests/paca.mjs
index 539abf6..6fcae53 100644
--- a/tests/paca.mjs
+++ b/tests/paca.mjs
@@ -2599,6 +2599,7 @@ const test_compileNFA = t => {
};
t.assertEq(compileNFA(""), expected);
});
+
t.testing("compiled sample regex", () => {
const nfa1 = compileNFA("(a|b)*c");
const expected1 = {
@@ -2743,6 +2744,19 @@ const test_compileNFA = t => {
const test_compileDFA = t => {
t.start("compileDFA()");
+ t.testing("empty regex", () => {
+ const expected = {
+ start: "2",
+ nodes: {
+ "2": {
+ end: true,
+ transitions: {},
+ },
+ },
+ };
+ t.assertEq(compileDFA(""), expected);
+ });
+
t.testing("compiled sample regex", () => {
const dfa1 = compileDFA("(a|b)*c");
const dfa2 = compileDFA("((a+b)?c|d)*e");