[svn openjsan.org] [476] Added Windows Scripting Host support.

4 views
Skip to first unread message

ca...@geeknest.com

unread,
Mar 23, 2006, 3:31:39 PM3/23/06
to jsan-...@googlegroups.com
Revision: 476
Author: theory
Date: 2006-03-23 15:31:32 -0500 (Thu, 23 Mar 2006)

Log Message:
-----------
Added Windows Scripting Host support. W00t!

Modified Paths:
--------------
users/theory/Test.Simple/trunk/doc/pod/Test/Builder.pod
users/theory/Test.Simple/trunk/lib/Test/Builder.js
Modified: users/theory/Test.Simple/trunk/doc/pod/Test/Builder.pod
===================================================================
--- users/theory/Test.Simple/trunk/doc/pod/Test/Builder.pod 2006-03-15 01:05:48 UTC (rev 475)
+++ users/theory/Test.Simple/trunk/doc/pod/Test/Builder.pod 2006-03-23 20:31:32 UTC (rev 476)
@@ -35,8 +35,16 @@

=item browser

+A Web browser.
+
=item director

+Adobe Director.
+
+=item wsh
+
+Windows Scripting Host.
+
=back

=back
@@ -390,11 +398,12 @@

These methods specify where test output and diagnostics will be sent. By
default, in a browser they all default to appending to the element with the
-"test" ID or, failing that, to using C<document.write>. In Macromedia
-Director, they use C<trace> for their output. If you wish to specify other
-functions that lack the C<apply()> method, you'll need to supply them instead
-as custom anonymous functions that take a single argument (multiple arguments
-will be concatenated before being passed to the output function):
+"test" ID or, failing that, to using C<document.write()>. In Adobe Director,
+they use C<trace()> for their output, and in Windows Scripting Host, they use
+C<WScript.StdOut.writeline()>. If you wish to specify other functions that
+lack the C<apply()> method, you'll need to supply them instead as custom
+anonymous functions that take a single argument (multiple arguments will be
+concatenated before being passed to the output function):

Test.output(function (msg) { foo(msg) });

@@ -666,8 +675,8 @@
global namespace. It is only used if JSAN (L<http://www.openjsan.org/>) is not
available. Other test modules built with Test.Builder should also use this
method to export functions. An optional second argument specifies the name
-space in which to export the functionls. Ifis not defined, it defaults to the
-C<window> object in browsers and the C<_global> object in Director.
+space in which to export the functionls. If it is not defined, it defaults to
+the C<window> object in browsers and the C<_global> object in Director.

=back

Modified: users/theory/Test.Simple/trunk/lib/Test/Builder.js
===================================================================
--- users/theory/Test.Simple/trunk/lib/Test/Builder.js 2006-03-15 01:05:48 UTC (rev 475)
+++ users/theory/Test.Simple/trunk/lib/Test/Builder.js 2006-03-23 20:31:32 UTC (rev 476)
@@ -9,6 +9,10 @@
//Director
if (typeof _global.Test == "undefined") _global.Test = {PLATFORM: 'director'};
else _global.Test.PLATFORM = 'director';
+} else if (typeof WScript != 'undefined') {
+ // WSH
+ if (typeof Test == 'undefined') Test = {PLATFORM: 'wsh'};
+ else Test.PLATFORM = 'wsh';
} else {
throw new Error("Test.More does not support your platform");
}
@@ -613,8 +617,18 @@
this.failureOutput(trace);
this.todoOutput(trace);
this.warnOutput(trace);
- }

+
+ } else if (Test.PLATFORM == 'wsh') {
+ // Windows Scripting Host Support
+ var writer = function (msg) {
+ WScript.StdOut.writeline(msg);
+ }
+ this.output(writer);
+ this.failureOutput(writer);
+ this.todoOutput(writer);
+ this.warnOutput(writer);
+ }
return this;
};

Reply all
Reply to author
Forward
0 new messages