Skip to content

Commit

Permalink
Test for classes evaluated from different frames.
Browse files Browse the repository at this point in the history
  • Loading branch information
ilonatommy committed Nov 11, 2021
1 parent 55479c8 commit 5f5cdf6
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>();
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<string>();
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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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;
}
}
}

0 comments on commit 5f5cdf6

Please sign in to comment.