Upsilon/UpsilonTests/StandardLibraryTests/BasicFunctionsTests.cs

29 lines
765 B
C#
Raw Normal View History

2018-11-23 12:34:46 +00:00
using System;
using Upsilon.Evaluator;
using Xunit;
namespace UpsilonTests.StandardLibraryTests
{
2018-11-23 11:55:28 +00:00
public class BasicFunctionsTests : TestClass
{
2018-11-23 11:55:28 +00:00
public BasicFunctionsTests(StaticScriptFixture fix) : base(fix)
{
}
[Fact]
2018-11-23 12:34:46 +00:00
public void AssertTest()
{
2018-11-23 11:55:28 +00:00
new Script("assert(true)", BoundScope, StaticScope).Evaluate();
2018-11-23 12:34:46 +00:00
Assert.Throws<Exception>(() => new Script("assert(false)", BoundScope, StaticScope).Evaluate());
}
[Fact]
public void Error()
{
var e = Assert.Throws<Exception>(() =>
new Script(@"error(""test_error"")", BoundScope, StaticScope).Evaluate());
Assert.Equal("test_error", e.Message);
}
2018-11-23 11:55:28 +00:00
}
}