diff --git a/src/Runtime.slnx b/src/Runtime.slnx index 5ae814033a..5e0418ec97 100644 --- a/src/Runtime.slnx +++ b/src/Runtime.slnx @@ -62,6 +62,7 @@ + diff --git a/src/Runtime/XSharp.VFP.UI.Tests/MenuFunctionTests.prg b/src/Runtime/XSharp.VFP.UI.Tests/MenuFunctionTests.prg new file mode 100644 index 0000000000..866f827350 --- /dev/null +++ b/src/Runtime/XSharp.VFP.UI.Tests/MenuFunctionTests.prg @@ -0,0 +1,64 @@ +// +// 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.UI.Tests + CLASS MenuFunctionTests + + STATIC CONSTRUCTOR + XSharp.RuntimeState.Dialect := XSharpDialect.FoxPro + END CONSTRUCTOR + + // BAR(), PAD(), POPUP() and MENU() read the last selection from MenuState. + // With no menu activated they must return the empty value, not NIL. + + [Fact, Trait("Category", "MenuFunctions")]; + METHOD BarReturnsZeroWhenNothingWasSelected AS VOID + Assert.Equal(0, (INT) BAR()) + END METHOD + + [Fact, Trait("Category", "MenuFunctions")]; + METHOD PadReturnsEmptyWhenNothingWasSelected AS VOID + Assert.Equal("", PAD()) + END METHOD + + [Fact, Trait("Category", "MenuFunctions")]; + METHOD PopupReturnsEmptyWhenNothingWasSelected AS VOID + Assert.Equal("", POPUP()) + END METHOD + + [Fact, Trait("Category", "MenuFunctions")]; + METHOD MenuReturnsEmptyWhenNothingWasSelected AS VOID + Assert.Equal("", MENU()) + END METHOD + + // The four lookup functions take a name. An unknown name is not an error, + // they return the empty value. + + [Fact, Trait("Category", "MenuFunctions")]; + METHOD MrkBarReturnsFalseForAnUnknownPopup AS VOID + Assert.False(MRKBAR("nosuchpopup", 1)) + END METHOD + + [Fact, Trait("Category", "MenuFunctions")]; + METHOD MrkPadReturnsFalseForAnUnknownMenu AS VOID + Assert.False(MRKPAD("nosuchmenu", "nosuchpad")) + END METHOD + + [Fact, Trait("Category", "MenuFunctions")]; + METHOD PrmBarReturnsEmptyForAnUnknownPopup AS VOID + Assert.Equal("", PRMBAR("nosuchpopup", 1)) + END METHOD + + [Fact, Trait("Category", "MenuFunctions")]; + METHOD PrmPadReturnsEmptyForAnUnknownMenu AS VOID + Assert.Equal("", PRMPAD("nosuchmenu", "nosuchpad")) + END METHOD + + END CLASS +END NAMESPACE diff --git a/src/Runtime/XSharp.VFP.UI.Tests/XSharp.VFP.UI.Tests.xsproj b/src/Runtime/XSharp.VFP.UI.Tests/XSharp.VFP.UI.Tests.xsproj new file mode 100644 index 0000000000..9dcecceb66 --- /dev/null +++ b/src/Runtime/XSharp.VFP.UI.Tests/XSharp.VFP.UI.Tests.xsproj @@ -0,0 +1,62 @@ + + + + + Library + net47 + XSharp.Runtime.VFP.UI.Tests + XSharp.VFP.UI.Tests + FoxPro + false + false + true + false + true + false + false + true + true + true + false + False + false + true + false + True + False + True + True + True + False + AnyCPU + XSharp.VFP.UI.Tests + + + + + + + + + + 4.3.1 + + + 2.4.2 + + + 2.4.3 + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + DEBUG;TRACE;NOASSERT + + + TRACE;NOASSERT + + + DEBUG;TRACE;NOASSERT + +