Adds Unary length operator
This commit is contained in:
27
UpsilonTests/GeneralTests/LengthOperatorTests.cs
Normal file
27
UpsilonTests/GeneralTests/LengthOperatorTests.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Upsilon.Binder;
|
||||
using Upsilon.Evaluator;
|
||||
using Upsilon.StandardLibraries;
|
||||
using Xunit;
|
||||
|
||||
namespace UpsilonTests.GeneralTests
|
||||
{
|
||||
public class LengthOperatorTests : TestClass
|
||||
{
|
||||
public LengthOperatorTests(StaticScriptFixture fix) : base(fix)
|
||||
{
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(@"#""test""", 4)]
|
||||
[InlineData(@"#{100,50,60,7863,1564,12354,10354}", 7)]
|
||||
public void Test(string input, long expectedOutput)
|
||||
{
|
||||
var script = new Script(input, BoundScope, StaticScope);
|
||||
Assert.Empty(script.Diagnostics.Messages);
|
||||
var actual = script.Evaluate<long>();
|
||||
Assert.Empty(script.Diagnostics.Messages);
|
||||
Assert.Equal(expectedOutput, actual);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ namespace UpsilonTests.StandardLibraryTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IPairsTest()
|
||||
public void UpTillNilPairsTest()
|
||||
{
|
||||
const string input = @"
|
||||
arr = {100, 56, 28, nil, 100}
|
||||
|
||||
Reference in New Issue
Block a user