diff options
author | aszlig <aszlig@nix.build> | 2018-07-18 16:51:44 +0200 |
---|---|---|
committer | aszlig <aszlig@nix.build> | 2018-07-19 06:35:48 +0200 |
commit | 3106b5dc491a75c8aa7a3696728aea9cd48d4cb7 (patch) | |
tree | eba37881a0adb428bea6fb4bf2424e312e6f94a0 /pkgs/games/build-support/monogame-patcher/src/test.sh | |
parent | e3c58ef839b4939503cc2da8859f92e28aa3b037 (diff) |
monogame-patcher: Allow to define specific methods
So far we only matched a substring of a type, which isn't very exact of course. We also weren't able to specify the method to patch. Now the methods that are being patched can be specified by using Type::Method. If it's just Type without a method all the methods of the type and its subtypes are patched. I also added a small check to make sure that all of these methods were found, and if not an error is thrown. Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'pkgs/games/build-support/monogame-patcher/src/test.sh')
-rw-r--r-- | pkgs/games/build-support/monogame-patcher/src/test.sh | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/pkgs/games/build-support/monogame-patcher/src/test.sh b/pkgs/games/build-support/monogame-patcher/src/test.sh index b7380f27..b03fa6cb 100644 --- a/pkgs/games/build-support/monogame-patcher/src/test.sh +++ b/pkgs/games/build-support/monogame-patcher/src/test.sh @@ -18,7 +18,7 @@ using System.IO; public class b { public static string replacement(string bar) { - if (bar == "nope") + if (bar == "nope" || bar == "yikes") return "nope"; Console.WriteLine("bar called: " + bar); return "bar"; @@ -49,15 +49,20 @@ EOF cat > "test1.cs" <<EOF class test1 { + public static void unrelated() { + b.replacement("yikes"); + } + public static void Main() { a.replaceMe("xxx"); b.replacement("nope"); + test1.unrelated(); } } EOF cat > "test2.cs" <<EOF -class test1 { +class test2 { public static void Main() { b.wrongFileStreamUse(); } @@ -87,7 +92,7 @@ test "$(mono subdir/test1.exe)" = "bar called: xxx" "$out/bin/monogame-patcher" replace-call -i subdir/test1.exe -a subdir/c.dll \ "System.String b::replacement(System.String)" \ "System.String c::anotherReplacement(System.String)" \ - test1 + test1::Main test "$(mono subdir/test1.exe)" = "foobar called: xxx" |