Upsilon/UpsilonTests/StandardLibraryTests/BasicFunctionsTests.cs

29 lines
765 B
C#

using System;
using Upsilon.Evaluator;
using Xunit;
namespace UpsilonTests.StandardLibraryTests
{
public class BasicFunctionsTests : TestClass
{
public BasicFunctionsTests(StaticScriptFixture fix) : base(fix)
{
}
[Fact]
public void AssertTest()
{
new Script("assert(true)", BoundScope, StaticScope).Evaluate();
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);
}
}
}