mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
pause and resume coverage
This commit is contained in:
parent
eb8788cb89
commit
4ccc10d056
1
bin/moon
1
bin/moon
@ -108,6 +108,7 @@ if not opts.d then
|
||||
else
|
||||
if cov then
|
||||
cov:stop()
|
||||
cov:print_results()
|
||||
end
|
||||
end
|
||||
else
|
||||
|
@ -59,8 +59,10 @@ end
|
||||
local CodeCoverage
|
||||
do
|
||||
local _base_0 = {
|
||||
start = function(self)
|
||||
reset = function(self)
|
||||
self.line_counts = create_counter()
|
||||
end,
|
||||
start = function(self)
|
||||
return debug.sethook((function()
|
||||
local _base_1 = self
|
||||
local _fn_0 = _base_1.process_line
|
||||
@ -70,8 +72,9 @@ do
|
||||
end)(), "l")
|
||||
end,
|
||||
stop = function(self)
|
||||
debug.sethook()
|
||||
local line_table = require("moonscript.line_tables")
|
||||
return debug.sethook()
|
||||
end,
|
||||
print_results = function(self)
|
||||
return self:format_results()
|
||||
end,
|
||||
process_line = function(self, _, line_no)
|
||||
@ -118,7 +121,9 @@ do
|
||||
}
|
||||
_base_0.__index = _base_0
|
||||
local _class_0 = setmetatable({
|
||||
__init = function() end,
|
||||
__init = function(self)
|
||||
return self:reset()
|
||||
end,
|
||||
__base = _base_0,
|
||||
__name = "CodeCoverage"
|
||||
}, {
|
||||
|
@ -40,14 +40,19 @@ format_file = (fname, positions) ->
|
||||
|
||||
|
||||
class CodeCoverage
|
||||
start: =>
|
||||
new: =>
|
||||
@reset!
|
||||
|
||||
reset: =>
|
||||
@line_counts = create_counter!
|
||||
|
||||
start: =>
|
||||
debug.sethook @\process_line, "l"
|
||||
|
||||
stop: =>
|
||||
debug.sethook!
|
||||
line_table = require "moonscript.line_tables"
|
||||
|
||||
print_results: =>
|
||||
@format_results!
|
||||
|
||||
process_line: (_, line_no) =>
|
||||
|
Loading…
Reference in New Issue
Block a user