More unit tests

This commit is contained in:
2018-11-23 13:34:46 +01:00
parent 8d6d6e45af
commit 1928979b40
3 changed files with 14 additions and 7 deletions

View File

@@ -1,3 +1,4 @@
using System;
using Upsilon.Evaluator;
using Xunit;
@@ -10,9 +11,18 @@ namespace UpsilonTests.StandardLibraryTests
}
[Fact]
public void Assert()
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);
}
}