Version 0.9.1-rc
- emote detection mixed in other channels - minimap button and dialog no longer resets active state after profile change - default entries are no longer shown after example import - better handling of capture groups and character sets
This commit is contained in:
@@ -18,10 +18,10 @@ function Grichelde:TestMatch(text, pattern)
|
||||
end
|
||||
|
||||
function Grichelde:RunTests()
|
||||
local function test(name, replacements, testData)
|
||||
local function test(name, replacements, testData, replaceEmotes)
|
||||
local i, ok, size = 0, 0, tSize(testData)
|
||||
for input, expected in pairs(testData) do
|
||||
local actual = self:ReplaceText(input, replacements, false)
|
||||
local actual = self:ReplaceText(input, replacements, replaceEmotes or false)
|
||||
i = i + 1
|
||||
if (actual == expected) then
|
||||
ok = ok + 1
|
||||
@@ -172,7 +172,7 @@ function Grichelde:RunTests()
|
||||
["abcdz"] = "aefgz",
|
||||
["abcd"] = "aefg",
|
||||
["bcdz"] = "efgz",
|
||||
-- replacement_10
|
||||
-- replacement_11
|
||||
["uio"] = "bnm",
|
||||
["auioz"] = "auioz",
|
||||
["auio"] = "auio",
|
||||
@@ -197,6 +197,19 @@ function Grichelde:RunTests()
|
||||
["awerz"] = "asdfz",
|
||||
["awer"] = "awer",
|
||||
["werz"] = "werz",
|
||||
|
||||
-- replacement_10
|
||||
["bcd abcdz abcd bcdz"] = "efg aefgz aefg efgz",
|
||||
-- replacement_11
|
||||
["uio auioz auio uioz"] = "bnm auioz auio uioz",
|
||||
-- replacement_12
|
||||
["hij ahijz ahij hijz"] = "klm ahijz ahij klmz",
|
||||
-- replacement_13
|
||||
["nop anopz anop nopz"] = "qrs anopz aqrs nopz",
|
||||
-- replacement_14
|
||||
["tuv atuvz atuv tuvz"] = "wxy atuvz awxy wxyz",
|
||||
-- replacement_15
|
||||
["wer awerz awer werz"] = "wer asdfz awer werz",
|
||||
}
|
||||
)
|
||||
ok = ok + o
|
||||
@@ -411,21 +424,31 @@ function Grichelde:RunTests()
|
||||
all = all + a
|
||||
|
||||
o, a = test(
|
||||
"Stottern",
|
||||
"Stottern 1",
|
||||
{
|
||||
replacement_10 = {
|
||||
order = 10,
|
||||
searchText = "^([^aeiouy]*)([aeiouy])",
|
||||
searchText = "^([^aeiouy]-)([aeiouy])",
|
||||
replaceText = "%1%2-%1%2-%1%2",
|
||||
exactCase = false,
|
||||
consolidate = true,
|
||||
matchWhen = 4,
|
||||
stopOnMatch = false,
|
||||
},
|
||||
replacement_11 = {
|
||||
order = 11,
|
||||
searchText = "([^bwp%s]-)([bwp])",
|
||||
replaceText = "%1%2-%1%2-%1%2",
|
||||
exactCase = false,
|
||||
consolidate = true,
|
||||
matchWhen = 2,
|
||||
stopOnMatch = false,
|
||||
},
|
||||
},
|
||||
{
|
||||
["Ich mag dich."] = "I-I-Ich mag dich.",
|
||||
["Dich mag ich."] = "Di-Di-Dich mag ich.",
|
||||
["Bmm rrpss w"] = "B-B-Bmm rrp-rrp-rrpss w-w-w",
|
||||
}
|
||||
)
|
||||
ok = ok + o
|
||||
@@ -695,7 +718,7 @@ function Grichelde:RunTests()
|
||||
replacement_13 = {
|
||||
order = 13,
|
||||
searchText = "youe",
|
||||
replaceText = "tho",
|
||||
replaceText = "thou",
|
||||
exactCase = false,
|
||||
consolidate = true,
|
||||
matchWhen = 3,
|
||||
@@ -709,6 +732,49 @@ function Grichelde:RunTests()
|
||||
ok = ok + o
|
||||
all = all + a
|
||||
|
||||
o, a = test(
|
||||
"emote detection on",
|
||||
{
|
||||
replacement_10 = {
|
||||
order = 10,
|
||||
searchText = "r",
|
||||
replaceText = "rr",
|
||||
exactCase = false,
|
||||
consolidate = false,
|
||||
matchWhen = 2,
|
||||
stopOnMatch = false,
|
||||
},
|
||||
},
|
||||
{
|
||||
["Der Herr Richter *schaut Herrn Richter an*"] = "Derr Herrrr Rrichterr *schaut Herrn Richter an*",
|
||||
["*schaut Herrn Richter an*"] = "*schaut Herrn Richter an*",
|
||||
}
|
||||
)
|
||||
ok = ok + o
|
||||
all = all + a
|
||||
|
||||
o, a = test(
|
||||
"emote detection ignored",
|
||||
{
|
||||
replacement_10 = {
|
||||
order = 10,
|
||||
searchText = "r",
|
||||
replaceText = "rr",
|
||||
exactCase = false,
|
||||
consolidate = false,
|
||||
matchWhen = 2,
|
||||
stopOnMatch = false,
|
||||
},
|
||||
},
|
||||
{
|
||||
["Der Herr Richter *schaut Herrn Richter an*"] = "Derr Herrrr Rrichterr *schaut Herrrrn Rrichterr an*",
|
||||
["*schaut Herrn Richter an*"] = "*schaut Herrrrn Rrichterr an*",
|
||||
},
|
||||
true
|
||||
)
|
||||
ok = ok + o
|
||||
all = all + a
|
||||
|
||||
if (ok == all) then
|
||||
self:PrefixedPrint("All %d tests %s", all, cGreen("passed"))
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user