67 private static string TestDirectory => Path.Combine(TestContext.CurrentContext.TestDirectory,
"tests");
97 BadSettingsProvider.RootSettings
98 .FindOrCreateProperty(
"Runtime.NativeOptimizations.UseConstantFunctionCaching")
104 runtime.UseNUnitConsole(builder);
108 $
".{BadRuntimeSettings.Instance.FileExtension}",
113 builder.
Register(
false,
false, files);
139 BadSettingsProvider.RootSettings
140 .FindOrCreateProperty(
"Runtime.NativeOptimizations.UseConstantFunctionCaching")
146 runtime.UseNUnitConsole(builder);
150 $
".{BadRuntimeSettings.Instance.FileExtension}",
155 builder.
Register(
true,
false, files);
181 BadSettingsProvider.RootSettings
182 .FindOrCreateProperty(
"Runtime.NativeOptimizations.UseConstantFunctionCaching")
188 runtime.UseNUnitConsole(builder);
192 $
".{BadRuntimeSettings.Instance.FileExtension}",
197 builder.
Register(
false,
true, files);
223 BadSettingsProvider.RootSettings
224 .FindOrCreateProperty(
"Runtime.NativeOptimizations.UseConstantFunctionCaching")
230 runtime.UseNUnitConsole(builder);
234 $
".{BadRuntimeSettings.Instance.FileExtension}",
239 builder.
Register(
true,
true, files);
265 BadSettingsProvider.RootSettings
266 .FindOrCreateProperty(
"Runtime.NativeOptimizations.UseConstantFunctionCaching")
272 runtime.UseNUnitConsole(builder);
276 $
".{BadRuntimeSettings.Instance.FileExtension}",
281 builder.
Register(
false,
false, files);
307 BadSettingsProvider.RootSettings
308 .FindOrCreateProperty(
"Runtime.NativeOptimizations.UseConstantFunctionCaching")
314 runtime.UseNUnitConsole(builder);
318 $
".{BadRuntimeSettings.Instance.FileExtension}",
323 builder.
Register(
true,
false, files);
350 BadSettingsProvider.RootSettings
351 .FindOrCreateProperty(
"Runtime.NativeOptimizations.UseConstantFunctionCaching")
357 runtime.UseNUnitConsole(builder);
361 $
".{BadRuntimeSettings.Instance.FileExtension}",
366 builder.
Register(
false,
true, files);
393 BadSettingsProvider.RootSettings
394 .FindOrCreateProperty(
"Runtime.NativeOptimizations.UseConstantFunctionCaching")
400 runtime.UseNUnitConsole(builder);
404 $
".{BadRuntimeSettings.Instance.FileExtension}",
409 builder.
Register(
false,
true, files);
434 BadRuntimeSettings.Instance.CatchRuntimeExceptions =
false;
494 .Where(x => x.AllowCompile)
532 .Where(x => x.AllowCompile)
560 .Where(x => x.AllowCompile)
588 .Where(x => x.AllowCompile)
689 HtmlDocument reference =
new HtmlDocument();
690 reference.Load(file);
704 string referenceFile = Path.ChangeExtension(file, $
".{(options.SkipEmptyTextNodes ? "skip
" : "default")}.html");
710 Assert.That(result.DocumentNode.OuterHtml, Is.EqualTo(reference.DocumentNode.OuterHtml.Replace(
"\r\n", Environment.NewLine)));
715 result.Save(referenceFile);
716 Assert.Inconclusive(
"Reference file does not exist. Saving...");
730 SkipEmptyTextNodes =
true,
732 string referenceFile = Path.ChangeExtension(file, $
".{(options.SkipEmptyTextNodes ? "skip
" : "default")}.html");
738 Assert.That(result.DocumentNode.OuterHtml, Is.EqualTo(reference.DocumentNode.OuterHtml.Replace(
"\r\n", Environment.NewLine)));
743 result.Save(referenceFile);
744 Assert.Inconclusive(
"Reference file does not exist. Saving...");
Implements a Html Template.
static BadHtmlTemplate Create(string file, IFileSystem? fileSystem=null)
Creates a new Template.
HtmlDocument RunTemplate(object? model=null, BadHtmlTemplateOptions? options=null, BadScope? caller=null)
Runs the Template with the specified arguments.
Options for the Html Template Engine.
Exposes the BadScript Runtime Functionality to Consumers.
Wrapper class for the console abstraction.
static void WriteLine(string str)
Writes a string to the console and appends a newline.
Public interface for the filesystem abstraction of the BadScript Engine.
static IFileSystem Instance
File System implementation.
Represents a BadScript NUnit Test Case.
Builds a BadScript NUnit Test Context.
BadUnitTestContext CreateContext(string workingDir)
Creates a new BadUnitTestContext.
void Register(bool optimizeFolding, bool optimizeSubstitution, params string[] files)
Registers one or multiple files to the Test Context.
Implements a BadScript NUnit Test Context.
void Setup()
Runs all Setup Functions.
static void Run(IEnumerable< BadObject > enumerable)
Runs an enumeration.
BadNUnitTestCase[] GetTestCases()
Returns all Test Cases.
void Teardown()
Runs all Teardown Functions.
Gets thrown by the runtime.
The Expression Function Implementation used if a function gets defined in the Source Code.
Implements a Compiled Function.
Implements an API for the Compiler.
static BadCompiledFunction CompileFunction(BadExpressionFunction func, bool useOverride)
Compiles a Function.
void TestOptimizedFolding(BadNUnitTestCase testCase)
Runs a Test Case.
void TestCompiledOptimizedSubstitution(BadNUnitTestCase testCase)
Runs a Test Case.
static BadNUnitTestCase[] GetOptimizedSubstitutionTestCases()
Gets all Test Cases.
static BadNUnitTestCase[] GetOptimizedFoldingTestCases()
Gets all Test Cases.
static string[] GetHtmlTemplateFiles()
Gets all HTML Test Cases.
static BadUnitTestContext CompiledOptimizedFoldingContext
The Compiled Optimized Folding Test Context.
static BadUnitTestContext Context
The Test Context.
void Test(BadNUnitTestCase testCase)
Runs a Test Case.
static BadUnitTestContext OptimizedSubstitutionContext
The Optimized Substitution Test Context.
static BadNUnitTestCase[] GetCompiledOptimizedFoldingTestCases()
Gets all Test Cases.
static BadUnitTestContext CompiledContext
The Compiled Test Context.
static string ScriptTestDirectory
The Script Test Directory.
static BadUnitTestContext CompiledOptimizedSubstitutionContext
The Compiled Optimized Substitution Test Context.
void Setup()
Setup the Test Contexts.
void TestOptimized(BadNUnitTestCase testCase)
Runs a Test Case.
static BadUnitTestContext CompiledOptimizedContext
The Compiled Optimized Test Context.
void TestHtmlTemplateDefault(string file)
Tests the Html Templates with the default options.
static ? BadUnitTestContext s_OptimizedFoldingContext
The Optimized Folding Test Context.
static string TestDirectory
The Test Directory.
void TestOptimizedSubstitution(BadNUnitTestCase testCase)
Runs a Test Case.
static HtmlDocument LoadReference(string file)
Loads a Reference File.
static BadNUnitTestCase[] GetCompiledOptimizedTestCases()
Gets all Test Cases.
static BadNUnitTestCase[] GetOptimizedTestCases()
Gets all Test Cases.
static ? BadUnitTestContext s_CompiledOptimizedSubstitutionContext
The Compiled Optimized Substitution Test Context.
static ? BadUnitTestContext s_CompiledContext
The Compiled Test Context.
static BadNUnitTestCase[] GetCompiledOptimizedSubstitutionTestCases()
Gets all Test Cases.
void TestCompiledOptimized(BadNUnitTestCase testCase)
Runs a Test Case.
void TestCompiled(BadNUnitTestCase testCase)
Runs a Test Case.
static ? BadUnitTestContext s_OptimizedSubstitutionContext
The Optimized Substitution Test Context.
static ? BadUnitTestContext s_CompiledOptimizedFoldingContext
The Compiled Optimized Folding Test Context.
static ? BadUnitTestContext s_OptimizedContext
The Optimized Test Context.
static ? BadUnitTestContext s_Context
The Test Context.
static string HtmlTestDirectory
The HTML Test Directory.
static BadUnitTestContext OptimizedContext
The Optimized Test Context.
static BadNUnitTestCase[] GetCompiledTestCases()
Gets all Test Cases.
static BadUnitTestContext OptimizedFoldingContext
The Optimized Folding Test Context.
void TearDown()
Tears down the Test Contexts.
static ? BadUnitTestContext s_CompiledOptimizedContext
The Compiled Optimized Test Context.
static BadNUnitTestCase[] GetTestCases()
Gets all Test Cases.
void TestHtmlTemplateSkipEmpty(string file)
Tests the Html Templates with the SkipEmptyTextNodes option.
void TestCompiledOptimizedFolding(BadNUnitTestCase testCase)
Runs a Test Case.
void CreateDirectory(string path, bool recursive=false)
Creates a new directory.
IEnumerable< string > GetFiles(string path, string extension, bool recursive)
Returns all files in the given directory that match the specified extension.
bool Exists(string path)
Returns true if the given path is a file or directory.
A Html Template Generator based on BadScript2.
Contains a Console Abstraction Layer to be able to Simulate Console Input/Output over the Network.
Contains IO Implementation for the BadScript2 Runtime.
Contains Common Interop Extensions and APIs for the BadScript2 Runtime.
Contains IO Extensions and APIs for the BadScript2 Runtime.
Contains JSON Extensions and APIs for the BadScript2 Runtime.
Contains Linq Extensions and APIs for the BadScript2 Runtime.
Contains NUnit Extensions and APIs for the BadScript2 Runtime.
Contains the Error Objects for the BadScript2 Language.
Contains Runtime Function Objects.
Contains Runtime Settings Objects.
Contains the Compiler for the BadVirtualMachine.
Contains the Virtual Machine Implementation.
Contains the Settings Implementation.