From 00a21be02170dfafc5aab520d63907ad69976a12 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 13 Jul 2025 20:34:22 -0300 Subject: Add first test for `rangeStateStep()` * tests/paca.mjs (test_rangeStateStep): Add first test case, for when we find a closing "}" when no comma was seen. --- tests/paca.mjs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/paca.mjs b/tests/paca.mjs index a4fed28..15e15ec 100644 --- a/tests/paca.mjs +++ b/tests/paca.mjs @@ -4,6 +4,7 @@ import { SyntaxError, ConcatStep, numFromDigits, + rangeStateStep, TRANSITION_FNS, shouldConcat, isOperator, @@ -59,6 +60,21 @@ const test_numFromDigits = t => { }); }; +const test_rangeStateStep = t => { + t.start("rangeStateStep()"); + + t.testing("error when comma is missing", () => { + const { value: { error }} = rangeStateStep( + { context: { where: "from" }}, + "}", + null, + null, + ); + t.assertEq(error.message, "missing comma in range operator"); + t.assertEq(error instanceof SyntaxError, true); + }); +}; + const test_TRANSITION_FNS = t => { t.start("TRANSITION_FNS"); @@ -2402,6 +2418,7 @@ const test_compile = t => { runTests([ test_numFromDigits, + test_rangeStateStep, test_TRANSITION_FNS, test_shouldConcat, test_isOperator, -- cgit v1.2.3