Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm][debugger] Create test Inherited Properties #56754

Merged
merged 2 commits into from
Aug 3, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,33 @@ public async Task GetSourceUsingSourceLink()
Assert.True(source.IsOk);
}

[Fact]
public async Task GetObjectValueWithInheritance()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have some tests for inherited members in https://github.com/dotnet/runtime/blob/main/src/mono/wasm/debugger/DebuggerTestSuite/GetPropertiesTests.cs . Can you add any missed cases there? or the new tests in that file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

{
var pause_location = await EvaluateAndCheck(
"window.setTimeout(function() { invoke_static_method('[debugger-test] TestChild:TestWatchWithInheritance'); }, 1);",
"dotnet://debugger-test.dll/debugger-test2.cs", 83, 4,
"TestWatchWithInheritance");
var frame_id = pause_location["callFrames"][0]["callFrameId"].Value<string>();
var frame_locals = await GetProperties(frame_id);
var test_props = await GetObjectOnLocals(frame_locals, "test");
Console.WriteLine($"test_props - {test_props}");
await CheckProps(test_props, new
{
j = TNumber(20),
i = TNumber(50),
k = TNumber(30),
GetJ = TGetter("GetJ"),
GetI = TGetter("GetI"),
GetK = TGetter("GetK")
}, "test_props");
await EvaluateOnCallFrameAndCheck(frame_id,
($"test.GetJ", TNumber(20)),
($"test.GetI", TNumber(50)),
($"test.GetK", TNumber(30))
);
}

//TODO add tests covering basic stepping behavior as step in/out/over
}
}
27 changes: 27 additions & 0 deletions src/mono/wasm/debugger/tests/debugger-test/debugger-test2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,30 @@ public static void BreakOnDebuggerBreakCommand()
Debugger.Break();
}
}

public class TestParent2
{
public int k = 30;
public int GetK => k;
}

public class TestParent : TestParent2
{
public int j = 20;
public int GetJ => j;
}

public class TestChild : TestParent
{
public int i = 50;
public int GetI => i;
public TestChild()
{
Console.WriteLine("Hi");
}
public static void TestWatchWithInheritance()
{
TestChild test = new TestChild();
Debugger.Break();
}
}