Skip to content
Browse files

`proof errors` displays bail outs.

I'd forgotten about bail outs when implementing `proof errors`. They've
been implemented here. Also, it appears that I wasn't properly chunking
output per assertion. Finally, I removed a `spewing` property that was
not in use.

Closes #20.
  • Loading branch information...
1 parent 4eb22e7 commit a4bc5539cacabe99d463c2954cdba27a4821da6e @bigeasy committed May 13, 2012
Showing with 18 additions and 17 deletions.
  1. +18 −17 src/bin/proof.coffee
View
35 src/bin/proof.coffee
@@ -291,30 +291,31 @@ errors = do ->
queue = []
failed = {}
parse process.stdin, (event) ->
- failure = failed[event.file]
- if event.type is "test"
- if not event.ok
- if not failure
- failure = failed[event.file] = { events: [ event ], spewing: true }
- queue.push failure
- else if failure
- failure.spewing = true
- else if failure and /^out|err|exit$/.test(event.type)
- failure.events.push event
- else if event.type is "exit" and event.code isnt 0
- queue.push failed[event.file] = { events: [ event ], spewing: true }
- prefix = ""
+ if failed[event.file]
+ failed[event.file].events.push event
+ delete failed[event.file] if (event.type is "test" and event.ok)
+ else if (event.type is "bail") or (event.type is "test" and not event.ok) or (event.type is "exit" and event.code)
+ queue.push failed[event.file] = { events: [ event ] }
+ prefix = "\n"
while queue.length and queue[0].events.length
event = queue[0].events.shift()
switch event.type
+ when "bail"
+ process.stdout.write "#{prefix}> #{red("\u2718")} #{event.file}: Bail Out!\n"
+ prefix = "\n\n"
when "test"
- if not queue[0].header
- process.stdout.write "> #{red("\u2718")} #{event.file}: #{event.message}\n\n"
- queue[0].header = true
+ say event
+ if event.ok
+ queue.shift()
+ else
+ process.stdout.write "#{prefix}> #{red("\u2718")} #{event.file}: #{event.message}\n"
+ prefix = "\n\n"
when "err", "out"
process.stdout.write "#{event.line}\n"
when "exit"
- process.stdout.write "\n> #{red("\u2718")} #{event.file}: exited with code #{event.code}\n"
+ if event.code
+ process.stdout.write "#{prefix}> #{red("\u2718")} #{event.file}: exited with code #{event.code}\n"
+ prefix = "\n\n"
queue.shift()
parser =

0 comments on commit a4bc553

Please sign in to comment.
Something went wrong with that request. Please try again.