Upsilon/UpsilonTests/GeneralTests/UserDataDictionaryTests.cs

32 lines
771 B
C#

using System.Collections.Generic;
using Upsilon;
using Upsilon.Evaluator;
using Xunit;
namespace UpsilonTests.GeneralTests
{
public class UserDataDictionaryTests : TestClass
{
[Fact]
public void BasicStringKeyed()
{
var arr = new Dictionary<string, int>
{
{"test", 100},
{"1234", 90},
{"here", 1683},
};
const string input = @"
function getValue(arr)
return arr[""here""]
end
";
var evaluated = Executor.EvaluateFunction<long>(input, "getValue", new[] {arr}, Options);
Assert.Equal(1683, evaluated);
}
public UserDataDictionaryTests(StaticScriptFixture fix) : base(fix)
{
}
}
}