summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-07-13 20:34:22 -0300
committerEuAndreh <eu@euandre.org>2025-07-13 20:34:24 -0300
commit00a21be02170dfafc5aab520d63907ad69976a12 (patch)
treeeb34cd72c7295d9aead920e97cff5391c67192ef /tests
parentHoist `numFromDigits()` before its usage (diff)
downloadpaca-00a21be02170dfafc5aab520d63907ad69976a12.tar.gz
paca-00a21be02170dfafc5aab520d63907ad69976a12.tar.xz
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.
Diffstat (limited to '')
-rw-r--r--tests/paca.mjs17
1 files changed, 17 insertions, 0 deletions
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,