diff --git a/Upsilon/StandardLibraries/Global.cs b/Upsilon/StandardLibraries/BasicFunctions.cs similarity index 100% rename from Upsilon/StandardLibraries/Global.cs rename to Upsilon/StandardLibraries/BasicFunctions.cs diff --git a/UpsilonTests/StandardLibraryTests/BasicFunctionsTests.cs b/UpsilonTests/StandardLibraryTests/BasicFunctionsTests.cs index 4cc9055..f3647e7 100644 --- a/UpsilonTests/StandardLibraryTests/BasicFunctionsTests.cs +++ b/UpsilonTests/StandardLibraryTests/BasicFunctionsTests.cs @@ -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(() => new Script("assert(false)", BoundScope, StaticScope).Evaluate()); + } + + [Fact] + public void Error() + { + var e = Assert.Throws(() => + new Script(@"error(""test_error"")", BoundScope, StaticScope).Evaluate()); + Assert.Equal("test_error", e.Message); } } diff --git a/UpsilonTests/TestClass.cs b/UpsilonTests/TestClass.cs index 3993b5e..bf1e22f 100644 --- a/UpsilonTests/TestClass.cs +++ b/UpsilonTests/TestClass.cs @@ -1,8 +1,5 @@ -using System.Collections.Generic; -using Upsilon.BaseTypes; using Upsilon.Binder; using Upsilon.Evaluator; -using Upsilon.StandardLibraries; using Xunit; namespace UpsilonTests @@ -10,10 +7,10 @@ namespace UpsilonTests [Collection("collection")] public abstract class TestClass { - public EvaluationScope StaticScope { get; } - public BoundScope BoundScope { get; } + protected EvaluationScope StaticScope { get; } + protected BoundScope BoundScope { get; } - public TestClass(StaticScriptFixture fix) + protected TestClass(StaticScriptFixture fix) { StaticScope = fix.StaticScope; BoundScope = fix.BoundScope;