Skip to content

Commit

Permalink
Update tests related to RegExMatch and mmikeww#118
Browse files Browse the repository at this point in the history
  • Loading branch information
safetycar committed Jul 22, 2023
1 parent 0f87be5 commit b91f28f
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if (FoundPos := RegExMatch("abcdefg", "f(g)", &OutputVar)) {
Text := ""
Text .= "$0: " OutputVar[0] "`n"
Text .= "$0: " (OutputVar && OutputVar[0]) "`n"
Text .= "$1: " OutputVar[1] "`n"
MsgBox(Text)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Func1() {
Func1()

Func2() {
local NotMatch, Match, NotMatch
local NotMatch, Match, MatchAbc, NotMatch
}
2 changes: 1 addition & 1 deletion tests/Test_Folder/String/RegExMatch/RegExMatch_ex7.ah2
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Path := "C:\Foo\Bar\Baz.txt"
RegExMatch(Path, "\w+$", &Extension)
MsgBox(Extension[0]) ; Reports "txt".
MsgBox((Extension && Extension[0])) ; Reports "txt".
2 changes: 1 addition & 1 deletion tests/Test_Folder/String/RegExMatch/RegExMatch_ex8.ah2
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Deref(Str)
while (fpo:=RegExMatch(Str, "(%(.*?)%)|``(.)", &m, (spo)<1 ? (spo)-1 : (spo)))
{
out .= SubStr(Str, (spo)<1 ? (spo)-1 : (spo), fpo-spo)
spo := fpo + StrLen(m[0])
spo := fpo + StrLen((m && m[0]))
if (m[1])
out .= %m[2]%
else switch (m[3])
Expand Down
8 changes: 8 additions & 0 deletions tests/Test_Folder/String/RegExMatch/issue_118-1.ah1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if RegExMatch(uri, "^\[url=")
RegExMatch(uri, "\G[^\]]*", uri, 6)
else
{
MsgBox 1,, URI appears invalid:`n%uri%
IfMsgBox Cancel
return
}
8 changes: 8 additions & 0 deletions tests/Test_Folder/String/RegExMatch/issue_118-1.ah2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if RegExMatch(uri, "^\[url=")
RegExMatch(uri, "\G[^\]]*", &uri, 6)
else
{
msgResult := MsgBox("URI appears invalid:`n" (uri && uri[0]), "", 1)
if (msgResult = "Cancel")
return
}
5 changes: 5 additions & 0 deletions tests/Test_Folder/String/RegExMatch/issue_118-2.ah1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

RegExMatch(haystack, regex, output)
x := task.output
x := task.output0
x := task.output1
5 changes: 5 additions & 0 deletions tests/Test_Folder/String/RegExMatch/issue_118-2.ah2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

RegExMatch(haystack, regex, &output)
x := task.output
x := task.output0
x := task.output1
10 changes: 10 additions & 0 deletions tests/Test_Folder/String/RegExMatch/issue_118-3.ah1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

a(s, r) {
RegExMatch(s, r, m)
a := m
b := m1
return m
}
b(m) {
return m
}
10 changes: 10 additions & 0 deletions tests/Test_Folder/String/RegExMatch/issue_118-3.ah2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

a(s, r) {
RegExMatch(s, r, &m)
a := (m && m[0])
c := m[1]
return (m && m[0])
}
b(m) {
return m
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
r := "1, 2, 3"
r := StrSplit(r.Length,",")
r[0] := 7
r := StrSplit(r,",")
r0 := 7

myfunc(randomwordwithr) {
return randomwordwithr
Expand Down

0 comments on commit b91f28f

Please sign in to comment.