<commit_before>namespace Boojay.Compilation.Tests

import Boo.Lang.Compiler.Ast

import NUnit.Framework from nunit.framework

[TestFixture]
partial class JarIntergrationTest(CommonIntegrationTest):
	override def compileTest(unit as CompileUnit):
		main = unit.Modules[0]
		main.Imports.Add([| import Boojay.Compilation.Tests |])
		
		compiler = newBooCompiler()
		compiler.Parameters.References.Add(typeof(CommonIntegrationTest).Assembly)
	
		result = compiler.Run(unit)
		assert 0 == len(result.Errors), result.Errors.ToString(true) + unit.ToCodeString()
			
	override def runTest(main as Module):
		return ""<commit_msg>implemented load and execution of jar integration script<commit_after>namespace Boojay.Compilation.Tests

import System.IO

import Boo.Lang.Compiler
import Boo.Lang.Compiler.Ast

import NUnit.Framework from nunit.framework

[TestFixture]
partial class JarIntergrationTest(CommonIntegrationTest):

	_assembly as Assembly
	
	override def compileTest(unit as CompileUnit):
		main = unit.Modules[0]
		main.Imports.Add([| import Boojay.Compilation.Tests |])
		
		compiler = newBooCompiler()
		compiler.Parameters.References.Add(typeof(CommonIntegrationTest).Assembly)
		compiler.Parameters.References.Add(typeof(Boo.Lang.Compiler.BooCompiler).Assembly)
	
		result = compiler.Run(unit)
		assert 0 == len(result.Errors), result.Errors.ToString(true) + unit.ToCodeString()
		
		_assembly = result.GeneratedAssembly
			
	override def runTest(main as Module):
		result = captureOutput:
			mainModule as duck = _assembly.GetTypes()[0]
			mainModule.Main(array(string,0))

		return result
		
	private def captureOutput(block as callable):
		old = System.Console.Out
		writer = StringWriter()
		System.Console.SetOut(writer)
		
		try:
			block()
		ensure:
			System.Console.SetOut(old)
			
		return writer.ToString()
		
{'fraction_non_alphanumeric': 0.10065645514223195, 'fraction_numerical': 0.0032822757111597373, 'mean_word_length': 4.99672131147541, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3630661', 'n_tokens_mistral': 611, 'n_tokens_neox': 543, 'n_words': 117}