Skip to content

Commit 5f5cdf6

Browse files
committed
Test for classes evaluated from different frames.
1 parent 55479c8 commit 5f5cdf6

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,29 @@ await EvaluateOnCallFrameAndCheck(id,
758758
("EvaluateNonStaticClassWithStaticFields.StaticProperty1", TString("StaticProperty1")),
759759
("EvaluateNonStaticClassWithStaticFields.StaticPropertyWithError", TString("System.Exception: not implemented")));
760760
});
761-
761+
762+
[Fact]
763+
public async Task EvaluateStaticClassesFromDifferentNamespaceInDifferentFrames() => await CheckInspectLocalsAtBreakpointSite(
764+
"DebuggerTestsV2.EvaluateStaticClass", "Run", 1, "Run",
765+
"window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.EvaluateMethodTestsClass:EvaluateMethods'); })",
766+
wait_for_event_fn: async (pause_location) =>
767+
{
768+
var id_top = pause_location["callFrames"][0]["callFrameId"].Value<string>();
769+
var frame = pause_location["callFrames"][0];
770+
771+
await EvaluateOnCallFrameAndCheck(id_top,
772+
("EvaluateStaticClass.StaticField1", TNumber(20)),
773+
("EvaluateStaticClass.StaticProperty1", TString("StaticProperty2")),
774+
("EvaluateStaticClass.StaticPropertyWithError", TString("System.Exception: not implemented")));
775+
776+
var id_second = pause_location["callFrames"][1]["callFrameId"].Value<string>();
777+
778+
await EvaluateOnCallFrameAndCheck(id_second,
779+
("EvaluateStaticClass.StaticField1", TNumber(10)),
780+
("EvaluateStaticClass.StaticProperty1", TString("StaticProperty1")),
781+
("EvaluateStaticClass.StaticPropertyWithError", TString("System.Exception: not implemented")));
782+
});
783+
762784
[Fact]
763785
public async Task EvaluateStaticClassInvalidField() => await CheckInspectLocalsAtBreakpointSite(
764786
"DebuggerTests.EvaluateMethodTestsClass/TestEvaluate", "run", 9, "run",

src/mono/wasm/debugger/tests/debugger-test/debugger-evaluate-test.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,8 @@ public static void EvaluateMethods()
403403
{
404404
TestEvaluate f = new TestEvaluate();
405405
f.run(100, 200, "9000", "test", 45);
406+
DebuggerTestsV2.EvaluateStaticClass.Run();
407+
var a = 0;
406408
}
407409

408410
public static void EvaluateAsyncMethods()
@@ -477,3 +479,18 @@ public static void EvaluateLocals()
477479
}
478480

479481
}
482+
483+
namespace DebuggerTestsV2
484+
{
485+
public static class EvaluateStaticClass
486+
{
487+
public static int StaticField1 = 20;
488+
public static string StaticProperty1 => "StaticProperty2";
489+
public static string StaticPropertyWithError => throw new Exception("not implemented");
490+
491+
public static void Run()
492+
{
493+
var a = 0;
494+
}
495+
}
496+
}

0 commit comments

Comments
 (0)