From 12da9e42551d44c6c2927dda27081eb873005bbf Mon Sep 17 00:00:00 2001 From: Irwin Rodriguez Date: Sun, 23 Aug 2026 11:27:50 +0200 Subject: [PATCH 1/2] Add tests for numeric properties in DEFINE CLASS --- src/Runtime/XSharp.VFP.Tests/OOPTests.prg | 39 +++++++++++++++++++ .../XSharp.VFP.Tests/XSharp.VFP.Tests.xsproj | 1 + 2 files changed, 40 insertions(+) create mode 100644 src/Runtime/XSharp.VFP.Tests/OOPTests.prg diff --git a/src/Runtime/XSharp.VFP.Tests/OOPTests.prg b/src/Runtime/XSharp.VFP.Tests/OOPTests.prg new file mode 100644 index 0000000000..b3c7fa8f84 --- /dev/null +++ b/src/Runtime/XSharp.VFP.Tests/OOPTests.prg @@ -0,0 +1,39 @@ +// +// Copyright (c) XSharp B.V. All Rights Reserved. +// Licensed under the Apache License, Version 2.0. +// See License.txt in the project root for license information. +// + + +using System +using XUnit + +begin namespace XSharp.VFP.Tests + class OOPTests + static constructor + XSharp.RuntimeState.Dialect := XSharpDialect.FoxPro + end constructor + + [Fact, Trait("Category", "OOP")]; + method NumericPropertyIsUsableInArithmetic as void + var oCircle := Circle{} + oCircle:Ratio := 5 + Assert.Equal(31.4, (real8)oCircle:Perimeter(), 2) + end method + + [Fact, Trait("Category", "OOP")]; + method NumericPropertyRoundTripsThroughLateBoundAccess as void + var oCircle := Circle{} + oCircle:Ratio := 5 + Assert.Equal(10, (int)(oCircle:Ratio * 2)) + end method + end class + + define class Circle as Custom + ratio = 0 + + procedure Perimeter() + return 2 * 3.14 * this.ratio + endproc + enddefine +end namespace diff --git a/src/Runtime/XSharp.VFP.Tests/XSharp.VFP.Tests.xsproj b/src/Runtime/XSharp.VFP.Tests/XSharp.VFP.Tests.xsproj index 37948e305d..06ab88e297 100644 --- a/src/Runtime/XSharp.VFP.Tests/XSharp.VFP.Tests.xsproj +++ b/src/Runtime/XSharp.VFP.Tests/XSharp.VFP.Tests.xsproj @@ -104,6 +104,7 @@ + From 5a7b2451985434d17ce25c61a2375966d0360c88 Mon Sep 17 00:00:00 2001 From: Irwin Rodriguez Date: Sun, 23 Aug 2026 11:35:24 +0200 Subject: [PATCH 2/2] Change to usual for late binding --- src/Runtime/XSharp.VFP.Tests/OOPTests.prg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Runtime/XSharp.VFP.Tests/OOPTests.prg b/src/Runtime/XSharp.VFP.Tests/OOPTests.prg index b3c7fa8f84..ae31a131d3 100644 --- a/src/Runtime/XSharp.VFP.Tests/OOPTests.prg +++ b/src/Runtime/XSharp.VFP.Tests/OOPTests.prg @@ -16,14 +16,14 @@ begin namespace XSharp.VFP.Tests [Fact, Trait("Category", "OOP")]; method NumericPropertyIsUsableInArithmetic as void - var oCircle := Circle{} + local oCircle := Circle{} as Circle oCircle:Ratio := 5 Assert.Equal(31.4, (real8)oCircle:Perimeter(), 2) end method [Fact, Trait("Category", "OOP")]; method NumericPropertyRoundTripsThroughLateBoundAccess as void - var oCircle := Circle{} + local oCircle := Circle{} as Usual oCircle:Ratio := 5 Assert.Equal(10, (int)(oCircle:Ratio * 2)) end method