<commit_before>#!/usr/bin/env ruby -w
#
#	Tests for the PluginFactory module
#

$:.unshift(File.join(File.dirname(__FILE__)), "lib")
$:.unshift(File.join(File.dirname(__FILE__)), "tests")

require "pluginfactory"
require "test/unit"

class FactoryTests < Test::Unit::TestCase


	def test_01_inclusion 
		assert_nothing_raised		{require "mybase"}
		assert						MyBase
		assert						MyBase.ancestors.include?( PluginFactory )
	end

	@@subs = %w{subof OtherSub SubOfMyBase othersubmybase deepsubof}

	def test_11_creation 
		@@subs.each {|sub|
			result = nil
			assert_nothing_raised		{result = MyBase.create(sub)}
			assert						result.kind_of?(MyBase)
			assert_match				%r[#{sub}]i, result.class.name
		}
	end


end # class FactoryTests
<commit_msg>- Added a hook into -d that turns on logging.<commit_after>#!/usr/bin/env ruby -w
#
#	Tests for the PluginFactory module
#

$:.unshift(File.join(File.dirname(__FILE__)), "lib")
$:.unshift(File.join(File.dirname(__FILE__)), "tests")

require "pluginfactory"
require "test/unit"

class FactoryTests < Test::Unit::TestCase
	
	def setup
		if $DEBUG
			PluginFactory.logger_callback = lambda {|lvl, msg|
				$deferr.puts msg
			}
		end
	end

	def test_01_inclusion 
		assert_nothing_raised		{require "mybase"}
		assert						MyBase
		assert						MyBase.ancestors.include?( PluginFactory )
	end

	@@subs = %w{subof OtherSub SubOfMyBase othersubmybase deepsubof}

	def test_11_creation 
		@@subs.each {|sub|
			result = nil
			assert_nothing_raised		{result = MyBase.create(sub)}
			assert						result.kind_of?(MyBase)
			assert_match				%r[#{sub}]i, result.class.name
		}
	end


end # class FactoryTests

{'fraction_non_alphanumeric': 0.12082574377656345, 'fraction_numerical': 0.004857316332726169, 'mean_word_length': 4.0552147239263805, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2152014', 'n_tokens_mistral': 684, 'n_tokens_neox': 591, 'n_words': 129}