More unit tests
This commit is contained in:
parent
8d6d6e45af
commit
1928979b40
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using Upsilon.Evaluator;
|
using Upsilon.Evaluator;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
@ -10,9 +11,18 @@ namespace UpsilonTests.StandardLibraryTests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Assert()
|
public void AssertTest()
|
||||||
{
|
{
|
||||||
new Script("assert(true)", BoundScope, StaticScope).Evaluate();
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using Upsilon.BaseTypes;
|
|
||||||
using Upsilon.Binder;
|
using Upsilon.Binder;
|
||||||
using Upsilon.Evaluator;
|
using Upsilon.Evaluator;
|
||||||
using Upsilon.StandardLibraries;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace UpsilonTests
|
namespace UpsilonTests
|
||||||
|
@ -10,10 +7,10 @@ namespace UpsilonTests
|
||||||
[Collection("collection")]
|
[Collection("collection")]
|
||||||
public abstract class TestClass
|
public abstract class TestClass
|
||||||
{
|
{
|
||||||
public EvaluationScope StaticScope { get; }
|
protected EvaluationScope StaticScope { get; }
|
||||||
public BoundScope BoundScope { get; }
|
protected BoundScope BoundScope { get; }
|
||||||
|
|
||||||
public TestClass(StaticScriptFixture fix)
|
protected TestClass(StaticScriptFixture fix)
|
||||||
{
|
{
|
||||||
StaticScope = fix.StaticScope;
|
StaticScope = fix.StaticScope;
|
||||||
BoundScope = fix.BoundScope;
|
BoundScope = fix.BoundScope;
|
||||||
|
|
Loading…
Reference in New Issue