Upsilon/UpsilonTests/UserDataDictionaryTests.cs

31 lines
771 B
C#
Raw Normal View History

using System.Collections.Generic;
using Upsilon.Evaluator;
using Xunit;
namespace UpsilonTests
{
public class UserDataDictionaryTests
{
[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 script = new Script(input);
Assert.Empty(script.Diagnostics.Messages);
var evaluated = script.EvaluateFunction<long>("getValue", new[] {arr});
Assert.Empty(script.Diagnostics.Messages);
Assert.Equal(1683, evaluated);
}
}
}