   fiber = null
   exit()
 
+# Exit the process. The exit code will be 0 on success, nonzero
+# if any test failed (it will actually equal the number of failed tests)
 exit = ->
   process.exit failed
 
+# Check if the test even makes any sense - each test needs at least
+# one expectation portion.
 test_is_ok = ->
   if !the_test.expects.length
     fail "does not have any expectations"
   else
     true
 
+# Run the current test. First apply its context ($) data, then run
+# its setup blocks, then block until the manager finishes the requested
+# key. Finally, run the expect blocks.
 run_test = ->
   requested = null
   if test_is_ok()

  else
    obj

setup = (body) ->
  context.setups.push body

worker = (args...) ->
  context.workers.push args

want = (value) ->
  context.expects.push -> wanted value

expect = (body) ->
  context.expects.push body

has = (hash) ->
  for key, value of hash
    context.lets[key] = value

test = (name, body) ->
  describe name, ->
    body()
    context.name = test_name.join(' ')
    tests.push context

fail = (msg) ->
  msg = msg.stack || msg
  console.log "#{the_test.name}: failed: #{msg}"

      value = lazy value
    $[name] = value

# Add all the test's defined workers to the manager; also, if the
# -w flag was specified, require that module and initialize it on
# the manager.
add_workers = ->
  if argv.w
    require(argv.w).init manager
  for args in the_test.workers
    manager.worker args...

# Set up the test scenario. create a new manager, apply test workers
# to it, and start it running. Then run setup blocks, and wait pending
# the manager to finish the requested key. If no key was requested,
# continue immediately to the expectation blocks.
run_setup = ->
  manager = new Manager { verbose, flush: true }
  add_workers()
