Welcome to mirror list, hosted at ThFree Co, Russian Federation.

run.lua - github.com/stevedonovan/Penlight.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4bc6ed6399cdc38e91869f04350c27be65817ec8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
-- running the tests and examples
require 'pl'
local lfs = require 'lfs'

-- get the Lua executable used to invoke this script
cmd = arg[-1]
if cmd:find '%s' then
	cmd = '"'..cmd..'"'
end

function do_lua_files ()
	for _,f in ipairs(dir.getfiles('.','*.lua')) do
		print(cmd..' '..f)
		local res = utils.execute(cmd..' '..f)
		if not res then
		 print ('process failed with non-zero result: '..f)
		 os.exit(1)
		end
	end
end

if #arg == 0 then arg[1] = 'tests'; arg[2] = 'examples' end

for _,dir in ipairs(arg) do
    print('directory',dir)
    lfs.chdir(dir)
    do_lua_files()
    lfs.chdir('..')
end