From dc86e7658ab4608c334c4782b98909233ab393d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 15 Nov 2016 13:21:43 +0100 Subject: test/lua: make tests more robust, print Lua include paths --- lua/test.sh | 7 +++---- lua/themes/theme.lua | 0 lua/visrc.lua | 10 ++++++---- 3 files changed, 9 insertions(+), 8 deletions(-) delete mode 100644 lua/themes/theme.lua diff --git a/lua/test.sh b/lua/test.sh index fd2c088..5d9b865 100755 --- a/lua/test.sh +++ b/lua/test.sh @@ -6,16 +6,15 @@ $VIS -v TESTS_OK=0 TESTS_RUN=0 -export VIS_PATH=. -export VIS_THEME=theme - if [ $# -gt 0 ]; then - printf ":help\n:w help\n:qall\n" $VIS && cat help test_files=$* else + printf ':help\n:/ Lua paths/,$ w help\n:qall\n' | $VIS 2> /dev/null && cat help && rm -f help test_files="$(find . -type f -name "*.in") basic_empty_file.in" fi +export VIS_PATH=. + for t in $test_files; do TESTS_RUN=$((TESTS_RUN + 1)) t=${t%.in} diff --git a/lua/themes/theme.lua b/lua/themes/theme.lua deleted file mode 100644 index e69de29..0000000 diff --git a/lua/visrc.lua b/lua/visrc.lua index cdb8e1c..9210c26 100644 --- a/lua/visrc.lua +++ b/lua/visrc.lua @@ -3,9 +3,11 @@ dofile("utils.lua") vis.events = {} vis.events.win_open = function(win) -- test.in file passed to vis - in_file = win.file.name - -- use the corresponding test.lua file - lua_file = string.gsub(in_file, '%.in$', '.lua') - dofile(lua_file) + local in_file = win.file.name + if in_file then + -- use the corresponding test.lua file + lua_file = string.gsub(in_file, '%.in$', '.lua') + dofile(lua_file) + end vis:command('q!') end -- cgit v1.2.3