Skip to content

Commit 6f9fce8

Browse files
committed
1 parent 1e32043 commit 6f9fce8

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

ConvertFuncs.ahk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Convert(ScriptString)
4040
StringRight,OutputVar,InputVar,Count | {1} := SubStr({2}, -{3}+1, {3})
4141
StringTrimLeft,OutputVar,InputVar,Count | {1} := SubStr({2}, 1, -{3})
4242
StringTrimRight,OutputVar,InputVar,Count | {1} := SubStr({2}, {3}+1)
43+
StringUpper,OutputVar,InputVar,Tvar | StrUpper, {1}, `%{2}`%[, {3}]
44+
StringLower,OutputVar,InputVar,Tvar | StrLower, {1}, `%{2}`%[, {3}]
4345
WinGetActiveStats,TitleVar,WidthVar,HeightVar,XVar,YVar | *ActiveStats
4446
WinGetActiveTitle,OutputVar | WinGetTitle, {1}, A
4547
DriveSpaceFree,OutputVar,PathVar | DriveGet, {1}, SpaceFree, {2}

tests/Tests.ahk

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,56 @@ class ConvertTests
744744
Yunit.assert(converted = expected)
745745
}
746746

747+
StringUpper()
748+
{
749+
input_script := "
750+
(LTrim Join`r`n %
751+
var = Chris Mallet
752+
StringUpper, newvar, var
753+
)"
754+
755+
expected := "
756+
(LTrim Join`r`n %
757+
var := "Chris Mallet"
758+
StrUpper, newvar, %var%
759+
)"
760+
761+
;MsgBox, Click OK and the following script will be run with AHK v2:`n`n%expected%
762+
;result := ExecScript(expected)
763+
;MsgBox, End of running script with AHK v2
764+
;msgbox, expected:`n`n%expected%
765+
converted := Convert(input_script)
766+
;msgbox, converted:`n`n%converted%
767+
Yunit.assert(converted = expected)
768+
}
769+
770+
StringLower()
771+
{
772+
input_script := "
773+
(LTrim Join`r`n %
774+
var = chris mallet
775+
StringLower, newvar, var, T
776+
if (newvar == "Chris Mallet")
777+
MsgBox, it worked
778+
)"
779+
780+
expected := "
781+
(LTrim Join`r`n %
782+
var := "chris mallet"
783+
StrLower, newvar, %var%, T
784+
if (newvar == "Chris Mallet")
785+
MsgBox, it worked
786+
)"
787+
788+
;MsgBox, Click OK and the following script will be run with AHK v2:`n`n%expected%
789+
;result := ExecScript(expected)
790+
;MsgBox, End of running script with AHK v2
791+
;msgbox, expected:`n`n%expected%
792+
converted := Convert(input_script)
793+
;msgbox, converted:`n`n%converted%
794+
Yunit.assert(converted = expected)
795+
}
796+
747797
End()
748798
{
749799
}

0 commit comments

Comments
 (0)