Adds simple string library

This commit is contained in:
2019-02-16 13:30:22 +01:00
parent 8da35b4e71
commit 93e256218d
6 changed files with 101 additions and 1 deletions

View File

@@ -1,6 +1,5 @@
using System;
using Upsilon;
using Upsilon.Evaluator;
using Xunit;
namespace UpsilonTests.StandardLibraryTests

View File

@@ -0,0 +1,26 @@
using Upsilon;
using Xunit;
namespace UpsilonTests.StandardLibraryTests
{
public class StringLibraryTests : TestClass
{
public StringLibraryTests(StaticScriptFixture fix) : base(fix)
{
}
[Fact]
public void ByteUse()
{
var result = Executor.EvaluateScript<long>(@"string.byte(""a"")", Options);
Assert.Equal('a', result);
}
[Fact]
public void ByteUseIndex()
{
var result = Executor.EvaluateScript<long>(@"string.byte(""abcd"", 3)", Options);
Assert.Equal('c', result);
}
}
}