New Search operation

This commit is contained in:
john19696 2022-10-06 12:38:24 +01:00
parent c2cf535f88
commit b18dbfff3d
4 changed files with 263 additions and 0 deletions

View file

@ -75,6 +75,7 @@ import "./tests/PowerSet.mjs";
import "./tests/Regex.mjs";
import "./tests/Register.mjs";
import "./tests/Rotate.mjs";
import "./tests/Searcn.mjs";
import "./tests/SeqUtils.mjs";
import "./tests/SetDifference.mjs";
import "./tests/SetIntersection.mjs";

View file

@ -0,0 +1,46 @@
/**
* StrUtils tests.
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "Search: HTML op",
input: "abc def\ndef abc",
expectedOutput: "<span class='hl2' title='Offset: 0\n\
Groups:\n\
\t1: abc\n\
'>abc</span> <span class='hl1' title='Offset: 4\n\
Groups:\n\
\t1: def\n\
'>def</span>\n\
<span class='hl2' title='Offset: 8\n\
Groups:\n\
\t1: def\n\
'>def</span> <span class='hl1' title='Offset: 12\n\
Groups:\n\
\t1: abc\n\
'>abc</span>",
recipeConfig: [
{
"op": "Search",
"args": ["abc\ndef", false, true, true, false, false, false, "Highlight matches"]
}
],
},
{
name: "Search: regex",
input: "abc def\ndef abc",
expectedOutput: "abc\ndef\ndef\nabc",
recipeConfig: [
{
"op": "Search",
"args": ["a.c\nd.f", true, true, true, false, false, false, "List matches"]
}
],
}
]);