summaryrefslogtreecommitdiff
path: root/tests/paca.mjs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/paca.mjs70
1 files changed, 35 insertions, 35 deletions
diff --git a/tests/paca.mjs b/tests/paca.mjs
index 6fcae53..14a6cf2 100644
--- a/tests/paca.mjs
+++ b/tests/paca.mjs
@@ -4,12 +4,12 @@ import {
SyntaxError,
ValueError,
ConcatStep,
+ shouldConcat,
numFromDigits,
escapingStateStep,
rangeStateStep,
classStateStep,
TRANSITION_FNS,
- shouldConcat,
isOperator,
tokenizeRegexStep,
tokenizeRegexFn,
@@ -48,6 +48,39 @@ import {
+const test_shouldConcat = t => {
+ t.start("shouldConcat()");
+
+ t.testing("do concat literal chars", () => {
+ t.assertEq(shouldConcat("a", "b"), true);
+ });
+
+ t.testing("but not when they're the last one", () => {
+ t.assertEq(shouldConcat("a", undefined), false);
+ t.assertEq(shouldConcat("b", undefined), false);
+ });
+
+ t.testing("do not concat when starting a parens group", () => {
+ t.assertEq(shouldConcat("(", "a"), false);
+ t.assertEq(shouldConcat("(", "b"), false);
+ });
+
+ t.testing("do not concat when starting a union", () => {
+ t.assertEq(shouldConcat("|", "a"), false);
+ t.assertEq(shouldConcat("|", "b"), false);
+ });
+
+ t.testing("do not concat when next is special", () => {
+ t.assertEq(shouldConcat("a", "*"), false);
+ t.assertEq(shouldConcat("a", "|"), false);
+ t.assertEq(shouldConcat("a", ")"), false);
+ });
+
+ t.testing("only consider the `next` char", () => {
+ t.assertEq(shouldConcat(null, "\\"), true);
+ });
+};
+
const test_numFromDigits = t => {
t.start("numFromDigits()");
@@ -519,39 +552,6 @@ const test_TRANSITION_FNS = t => {
});
};
-const test_shouldConcat = t => {
- t.start("shouldConcat()");
-
- t.testing("do concat literal chars", () => {
- t.assertEq(shouldConcat("a", "b"), true);
- });
-
- t.testing("but not when they're the last one", () => {
- t.assertEq(shouldConcat("a", undefined), false);
- t.assertEq(shouldConcat("b", undefined), false);
- });
-
- t.testing("do not concat when starting a parens group", () => {
- t.assertEq(shouldConcat("(", "a"), false);
- t.assertEq(shouldConcat("(", "b"), false);
- });
-
- t.testing("do not concat when starting a union", () => {
- t.assertEq(shouldConcat("|", "a"), false);
- t.assertEq(shouldConcat("|", "b"), false);
- });
-
- t.testing("do not concat when next is special", () => {
- t.assertEq(shouldConcat("a", "*"), false);
- t.assertEq(shouldConcat("a", "|"), false);
- t.assertEq(shouldConcat("a", ")"), false);
- });
-
- t.testing("only consider the `next` char", () => {
- t.assertEq(shouldConcat(null, "\\"), true);
- });
-};
-
const test_isOperator = t => {
t.start("isOperator()");
@@ -2830,12 +2830,12 @@ const test_compile = t => {
runTests([
+ test_shouldConcat,
test_numFromDigits,
test_escapingStateStep,
test_rangeStateStep,
test_classStateStep,
test_TRANSITION_FNS,
- test_shouldConcat,
test_isOperator,
test_tokenizeRegexStep,
test_tokenizeRegexFn,