#!/usr/bin/ruby -I. -w

require "runit/testcase"
require "runit/cui/testrunner"

require "test/core_test"
require "test/xpath_test"
require "test/sub_test"
require "test/contrib_test"

# Possible usage:
# 	suite.rb xpath				runs the XPath suite
# 	suite.rb xpath <test>	runs <test> from the XPath suite
# 	suite.rb <test>			runs <test> from the core suite
# 	suite.rb						runs all tests
if ARGV.size > 0
	test = ARGV[0]
	# This is really inefficient, but how else?
	ObjectSpace.each_object(Class) {|ob| test = ob if ob.name == test }
	if ARGV.size == 2
		test = test.new(ARGV[1])
	else
		test = test.suite
	end
	RUNIT::CUI::TestRunner.run( test )
else
	RUNIT::CUI::TestRunner.run( Tester.suite )
	RUNIT::CUI::TestRunner.run( XPathTester.suite )
	RUNIT::CUI::TestRunner.run( ContribTester.suite )
end
