Upsilon/UpsilonTests/TestClass.cs

45 lines
1.2 KiB
C#

using Upsilon;
using Upsilon.Binder;
using Upsilon.Evaluator;
using Xunit;
namespace UpsilonTests
{
[Collection("collection")]
public abstract class TestClass
{
protected EvaluationScope StaticScope { get; }
protected BoundScope BoundScope { get; }
protected ScriptOptions Options { get; }
protected TestClass(StaticScriptFixture fix)
{
StaticScope = fix.StaticScope;
BoundScope = fix.BoundScope;
Options = new ScriptOptions()
{
OverrideStaticScope = StaticScope,
OverrideStaticBoundScope = BoundScope,
};
}
}
[CollectionDefinition("collection")]
public class StaticScriptContext : ICollectionFixture<StaticScriptFixture>
{
}
public class StaticScriptFixture
{
public EvaluationScope StaticScope { get; }
public BoundScope BoundScope { get; }
public StaticScriptFixture()
{
var (evaluationScope, boundScope) = Upsilon.StandardLibraries.StaticScope.CreateStandardLibrary();
StaticScope = evaluationScope;
BoundScope = boundScope;
}
}
}