diff --git a/src/Runtime/XSharp.VFP.Tests/OOPTests.prg b/src/Runtime/XSharp.VFP.Tests/OOPTests.prg new file mode 100644 index 0000000000..ae31a131d3 --- /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 + 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 + local oCircle := Circle{} as Usual + 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 @@ +