Add new test() function to simplify unit tests

I also added the bind() function which is used to produce the log argument
expected by the test() function to report the outcome of the test:
bind( document.write, document ) results in calls to document.write()
with the proper context set.