Skip to content

Commit

Permalink
make testing work with latest version of busted
Browse files Browse the repository at this point in the history
  • Loading branch information
leafo committed Mar 19, 2013
1 parent cdd413a commit 499afba
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

test::
TIME=1 lua5.1 bin/moon test2.moon
moonc test2.moon && TIME=1 busted test2.lua

local:
luarocks make --local moonscript-dev-1.rockspec
Expand Down
50 changes: 21 additions & 29 deletions test2.moon
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

require "lfs"
require "busted"
lfs = require "lfs"

parse = require "moonscript.parse"
compile = require "moonscript.compile"
Expand Down Expand Up @@ -118,31 +117,24 @@ describe "input tests", ->

nil

busted.options = {
output: require'busted.output.utf_terminal'!
suppress_pending: true
}

print busted!

if options.show_timings
format_time = (sec) -> ("%.3fms")\format(sec*1000)
col_width = math.max unpack [#t[1] for t in *timings]

print "\nTimings:"
total_parse, total_compile = 0, 0
for tuple in *timings
name, parse_time, compile_time = unpack tuple
name = name .. (" ")\rep col_width - #name
total_parse += parse_time
total_compile += compile_time

print " * " .. name,
"p: " .. format_time(parse_time),
"c: " .. format_time(compile_time)

print "\nTotal:"
print " parse:", format_time total_parse
print " compile:", format_time total_compile

if options.show_timings
teardown ->
format_time = (sec) -> ("%.3fms")\format(sec*1000)
col_width = math.max unpack [#t[1] for t in *timings]

print "\nTimings:"
total_parse, total_compile = 0, 0
for tuple in *timings
name, parse_time, compile_time = unpack tuple
name = name .. (" ")\rep col_width - #name
total_parse += parse_time
total_compile += compile_time

print " * " .. name,
"p: " .. format_time(parse_time),
"c: " .. format_time(compile_time)

print "\nTotal:"
print " parse:", format_time total_parse
print " compile:", format_time total_compile

0 comments on commit 499afba

Please sign in to comment.