Skip to content

Commit

Permalink
Add test for IssueTypeResolver should resolve to non-hidden property …
Browse files Browse the repository at this point in the history
…over property it hides #1962
  • Loading branch information
mspertus committed Sep 4, 2024
1 parent 14ab9bc commit 55237d6
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Jint.Tests/Runtime/InteropTests.MemberAccess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,25 @@ public void CanConfigureStrictAccess()

engine.Invoking(e => e.Evaluate("obj.AgeMissing")).Should().Throw<MissingMemberException>();
}
}

public class ClassWithPropertyToHide
{
public int x { get; set; } = 2;
public int y { get; set; } = 3;
}

public class ClassThatHidesProperty : ClassWithPropertyToHide
{
public new bool x { get; set; } = true;
}

[Fact]
public void ShouldRespectExplicitHiding()
{
var engine = new Engine();

engine.SetValue("obj", new ClassThatHidesProperty());
engine.Evaluate("obj.x").AsBoolean().Should().BeTrue();
engine.Evaluate("obj.y").AsNumber().Should().Be(3);
}
}

0 comments on commit 55237d6

Please sign in to comment.