vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 4e2b04f3eeaade90ffc737c23df28e5d0ad94deb parent d4e5dcf4f841be6eb191606105320ebe007d31a0 Author: Josh Wainwright <josh.wainwright@ldra.com> Date: Thu, 21 Apr 2016 10:37:48 +0100 Add test for file that does not exist Diffstat:
| A | lua/basic_empty_file.lua | | | 15 | +++++++++++++++ |
| M | lua/test.sh | | | 2 | +- |
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/lua/basic_empty_file.lua b/lua/basic_empty_file.lua @@ -0,0 +1,15 @@ +-- Tests vis.win.file.* for a file that doesn't exist +local win = vis.win +local results = {} +results[1] = win.file.name == 'basic_empty_file.in' +results[2] = win.file.newlines == 'nl' +results[3] = win.file.size == 0 +results[4] = #win.file.lines == 0 +results[5] = win.file.lines[0] == '' +results[6] = win.file.syntax or 'true' + +delete(win, '%') +for i = 1, #results do + append(win, i-1, tostring(results[i])) +end +vis:command('w! basic_empty_file.status') diff --git a/lua/test.sh b/lua/test.sh @@ -12,7 +12,7 @@ export VIS_THEME=theme if [ $# -gt 0 ]; then test_files=$@ else - test_files=$(find . -type f -name "*.in") + test_files="$(find . -type f -name "*.in") basic_empty_file.in" fi for t in $test_files; do