From 732eb4685f44ee349ff352f038eceb4df3cae6fc Mon Sep 17 00:00:00 2001 From: Ven0m0 <82972344+Ven0m0@users.noreply.github.com> Date: Tue, 28 Apr 2026 21:59:09 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20Add=20tests=20for=20RegExEscape?= =?UTF-8?q?=20in=20CitraConfigHelpers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- .../v2/CitraConfigHelpers_Test.ahk | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Other/Citra_per_game_config/v2/CitraConfigHelpers_Test.ahk b/Other/Citra_per_game_config/v2/CitraConfigHelpers_Test.ahk index 6cdb983..21b7ef6 100644 --- a/Other/Citra_per_game_config/v2/CitraConfigHelpers_Test.ahk +++ b/Other/Citra_per_game_config/v2/CitraConfigHelpers_Test.ahk @@ -17,6 +17,26 @@ AssertEqual(actual, expected, testName) { } } +TestRegExEscape() { + global stdout + stdout.WriteLine("Running TestRegExEscape...") + + ; Test 1: Empty string + AssertEqual(RegExEscape(""), "", "RegExEscape handles empty string") + + ; Test 2: No special characters + AssertEqual(RegExEscape("hello"), "hello", "RegExEscape leaves alphanumeric characters unchanged") + + ; Test 3: Some special characters + AssertEqual(RegExEscape("h.e*l+l?o"), "h\.e\*l\+l\?o", "RegExEscape escapes dot, star, plus, question mark") + + ; Test 4: Brackets and braces + AssertEqual(RegExEscape("(hello)[world]{test}"), "\(hello\)\[world\]\{test\}", "RegExEscape escapes brackets and braces") + + ; Test 5: Caret, dollar, pipe, backslash + AssertEqual(RegExEscape("^hello$|world\"), "\^hello\$\|world\\", "RegExEscape escapes caret, dollar, pipe, backslash") +} + TestReplaceInFile() { global stdout stdout.WriteLine("Running TestReplaceInFile...") @@ -63,6 +83,7 @@ TestReplaceInFile() { FileDelete(testFile . ".bak") } +TestRegExEscape() TestReplaceInFile() stdout.WriteLine("Tests Passed: " . testsPassed)