Skip to content

Commit

Permalink
Add docs for Builder
Browse files Browse the repository at this point in the history
  • Loading branch information
Whiteknight committed Jun 9, 2011
1 parent 177308a commit e090f6c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ src/_build/*
_site
/test.*
src/unstable/utilities/installable_winxed_repl
rosella/
10 changes: 10 additions & 0 deletions src/test/Builder.winxed
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Rosella { namespace Test
var test_number;
var output;

// Constructor
function Builder(var output [optional], int has_out [opt_flag])
{
self.test_number = 0;
Expand All @@ -16,16 +17,20 @@ namespace Rosella { namespace Test
self.output = output;
}

// Helper printf function
function _printf(string fmt, var args [slurpy])
{
self.output.print(sprintf(fmt, args));
}

// Reset the count
function reset()
{
self.test_number = 0;
}

// Display a todo result. pass=1 means an unexpected pass. pass=0 is
// an expected failure
function todo(int pass, string msg,
string todo [optional], int has_todo [opt_flag])
{
Expand All @@ -36,6 +41,8 @@ namespace Rosella { namespace Test
self._printf("%s # TODO %s\n", output, todo);
}

// Display a normal result. pass=1 is an expected test pass. pass=0
// is an unexpected failure
function ok(int pass, string msg [optional], int has_msg [opt_flag])
{
self.test_number = self.test_number + 1;
Expand All @@ -45,6 +52,7 @@ namespace Rosella { namespace Test
self._printf("%s\n", result_text);
}

// helper function to get the display text for the result
function _get_result_text(int number, int pass, string msg)
{
string result = null;
Expand All @@ -58,6 +66,7 @@ namespace Rosella { namespace Test
return result;
}

// display diagnostics information as comments
function diag(var error)
{
if (error instanceof "Exception") {
Expand All @@ -76,6 +85,7 @@ namespace Rosella { namespace Test
self._printf("# %s\n", string(error));
}

// print out a plan
function plan(int count)
{
// TODO: Error checking
Expand Down

0 comments on commit e090f6c

Please sign in to comment.