From 5f5cdf627da6eeaa173a68541c402dec53049ff2 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Thu, 11 Nov 2021 12:57:01 +0100 Subject: [PATCH] Test for classes evaluated from different frames. --- .../EvaluateOnCallFrameTests.cs | 24 ++++++++++++++++++- .../debugger-test/debugger-evaluate-test.cs | 17 +++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs index d13cff819953c..e7da3d4bfa59c 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs @@ -758,7 +758,29 @@ await EvaluateOnCallFrameAndCheck(id, ("EvaluateNonStaticClassWithStaticFields.StaticProperty1", TString("StaticProperty1")), ("EvaluateNonStaticClassWithStaticFields.StaticPropertyWithError", TString("System.Exception: not implemented"))); }); - + + [Fact] + public async Task EvaluateStaticClassesFromDifferentNamespaceInDifferentFrames() => await CheckInspectLocalsAtBreakpointSite( + "DebuggerTestsV2.EvaluateStaticClass", "Run", 1, "Run", + "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.EvaluateMethodTestsClass:EvaluateMethods'); })", + wait_for_event_fn: async (pause_location) => + { + var id_top = pause_location["callFrames"][0]["callFrameId"].Value(); + var frame = pause_location["callFrames"][0]; + + await EvaluateOnCallFrameAndCheck(id_top, + ("EvaluateStaticClass.StaticField1", TNumber(20)), + ("EvaluateStaticClass.StaticProperty1", TString("StaticProperty2")), + ("EvaluateStaticClass.StaticPropertyWithError", TString("System.Exception: not implemented"))); + + var id_second = pause_location["callFrames"][1]["callFrameId"].Value(); + + await EvaluateOnCallFrameAndCheck(id_second, + ("EvaluateStaticClass.StaticField1", TNumber(10)), + ("EvaluateStaticClass.StaticProperty1", TString("StaticProperty1")), + ("EvaluateStaticClass.StaticPropertyWithError", TString("System.Exception: not implemented"))); + }); + [Fact] public async Task EvaluateStaticClassInvalidField() => await CheckInspectLocalsAtBreakpointSite( "DebuggerTests.EvaluateMethodTestsClass/TestEvaluate", "run", 9, "run", diff --git a/src/mono/wasm/debugger/tests/debugger-test/debugger-evaluate-test.cs b/src/mono/wasm/debugger/tests/debugger-test/debugger-evaluate-test.cs index a00b131060478..0d8cd9ada9046 100644 --- a/src/mono/wasm/debugger/tests/debugger-test/debugger-evaluate-test.cs +++ b/src/mono/wasm/debugger/tests/debugger-test/debugger-evaluate-test.cs @@ -403,6 +403,8 @@ public static void EvaluateMethods() { TestEvaluate f = new TestEvaluate(); f.run(100, 200, "9000", "test", 45); + DebuggerTestsV2.EvaluateStaticClass.Run(); + var a = 0; } public static void EvaluateAsyncMethods() @@ -477,3 +479,18 @@ public static void EvaluateLocals() } } + +namespace DebuggerTestsV2 +{ + public static class EvaluateStaticClass + { + public static int StaticField1 = 20; + public static string StaticProperty1 => "StaticProperty2"; + public static string StaticPropertyWithError => throw new Exception("not implemented"); + + public static void Run() + { + var a = 0; + } + } +} \ No newline at end of file