test/sam: add tests for empty matches at the end of a range
[vis-test.git] / lua / visrc.lua
blob16aa8b9959abcbdc226fa5bdcbe96d2c20e91a4a
1 package.path = '../../lua/?.lua;'..package.path
2 dofile("../../lua/vis.lua")
4 -- redirect output to stdout, stderr is used by the vis UI
5 io.stderr = io.stdout
7 -- make sure we gracefully terminate, cleanup terminal state etc.
8 os.exit = function(status)
9 vis:exit(status)
10 end
12 vis.events.subscribe(vis.events.WIN_OPEN, function(win)
13 -- test.in file passed to vis
14 local in_file = win.file.name
15 if in_file then
16 -- use the corresponding test.lua file
17 lua_file = string.gsub(in_file, '%.in$', '.lua')
18 local ok, msg = pcall(dofile, lua_file)
19 if not ok then
20 if type(msg) == 'string' then
21 print(msg)
22 end
23 vis:exit(1)
24 return
25 end
26 end
27 vis:exit(0)
28 end)