lua代码检查脚本

RsCov.lua:


--[[
Sample:

-- test/test2/t.lua :

function testt()
	print("hello world")
	print("bad world")
end


-- test.lua :

require("RsCov")
require("test/test2/t")

RsCov.start_cov( "test/test2/t.lua" )


testt()

local dump = RsCov.dump_file("t.lua")
print(dump)

-- output :
hello world
bad world
Cov:3 Uncov:6 Total:9 Pct:0.33333333333333
1   0
2   0
3   0 function testt()
4   1 	print("hello world")
5   1 	print("bad world")
6   1 end
7   0
8   0
9   0


]]

file_tbl = file_tbl or {}
rawcoroutinecreate = rawcoroutinecreate or coroutine.create
rawcoroutinewrap = rawcoroutinewrap or coroutine.wrap
rawexit = rawexit or os.exit
IsStarted = IsStarted or false

function trim_path( name )
   	local s1,s2,s3
	s1= name:find("/", 1, true )
	while s1 do
		s2 = s1
		s1 = name:find("/", s1+1, true )
	end

	if s2 then
		s1,s3= name:find(".\\", s2+1, true )
	else
		s1,s3= name:find(".\\", 1, true )
	end

	while s1 do
		s2 = s3
		s1 = name:find(".\\", s2+1, true )
	end

	if s2 then
		name = name:sub( s2+1 )
	end
	return name
end


local function on_line(_, line_nr)
   -- get name of processed file; ig
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值