Permalink
Browse files

small cleanups to the test templates and docs for Test namespace

  • Loading branch information...
1 parent 8c2ddf5 commit 3e8eef2bbf00a185b35d89c59e4bfa05694fcb93 @Whiteknight committed Jan 22, 2012
@@ -17,8 +17,7 @@ class Test_<# class.cleanname #>
var obj = new <# class.winxedname #>();
self.assert.not_null(obj);
self.assert.instance_of(obj, class <# class.winxedname #>);
- }
-<$ for method in class.methods $><%
+ }<$ for method in class.methods $><%
string key = context.get_value("__KEY__");
var method = context.get_value("class.methods")[key];
// TODO: Handle MultiSub. Does not have .arity() method
@@ -4,10 +4,7 @@ class Test_<# ns.cleanname #>
function test_sanity()
{
self.assert.is_true(1);
- }
-
- // Tests for Functions
- <$ for subobj in ns.subs $><%
+ }<$ for subobj in ns.subs $><%
var sub = context.get_value("subobj");
int arity = sub.arity();
context.set_temporary("sub_arity", arity - 1);
View
@@ -46,6 +46,8 @@ namespace Rosella.Test
return result.was_successful();
}
+ // Tests in the form of a list. The first argument is a list of callback
+ // functions to execute as individual tests
function test_list(var list, var options [slurpy,named])
{
__default_options(options);
@@ -56,20 +58,23 @@ namespace Rosella.Test
return result.was_successful();
}
+ // Make a standard Suite object for class-based tests
function make_suite(var test_type, var options [slurpy,named])
{
__default_options(options);
var suitefactory = new Rosella.Test.SuiteFactory(test_type, options);
return suitefactory.create();
}
+ // Make a Suite object for vector-based tests
function make_suite_vector(var func, var tests, var options [slurpy,named])
{
__default_options(options);
var suitefactory = new Rosella.Test.SuiteFactory.Vector(func, tests, options);
return suitefactory.create();
}
+ // Get the matcher factory
const string DEFAULT_MATCHER_FACTORY = "Rosella.Test.matcher_factory";
function matcher_factory()
{
@@ -81,11 +86,13 @@ namespace Rosella.Test
return temp;
}
+ // Add a new matcher to the registry by role name
function add_role_matcher(string role, var matcher)
{
Rosella.Test.matcher_factory().add_role_matcher(role, matcher);
}
+ // Add a new matcher to the registry by type
function add_type_matcher(string type, var matcher)
{
Rosella.Test.matcher_factory().add_type_matcher(type, matcher);
@@ -94,6 +101,7 @@ namespace Rosella.Test
/* Private or Internal Routines
*/
+ // Execute an initialization callback
function __initialize_test(var suitefactory, var options)
{
if (exists options["initialize"])

0 comments on commit 3e8eef2

Please sign in to comment.