aboutsummaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorJosh Wainwright <josh.wainwright@ldra.com>2016-04-21 10:37:48 +0100
committerJosh Wainwright <josh.wainwright@ldra.com>2016-04-21 10:37:48 +0100
commitf6ff4e24e5003542e59c0a3e5df7a1af8896006a (patch)
treedc643f55430a1ac0f4c8677bec29b43686423270 /lua
parent3e47a926e7687d52ac2df06d5b664afd4f644971 (diff)
downloadvis-f6ff4e24e5003542e59c0a3e5df7a1af8896006a.tar.gz
vis-f6ff4e24e5003542e59c0a3e5df7a1af8896006a.tar.xz
Add test for file that does not exist
Diffstat (limited to 'lua')
-rw-r--r--lua/basic_empty_file.lua15
-rw-r--r--[-rwxr-xr-x]lua/test.sh2
2 files changed, 16 insertions, 1 deletions
diff --git a/lua/basic_empty_file.lua b/lua/basic_empty_file.lua
new file mode 100644
index 0000000..de1c14e
--- /dev/null
+++ 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
index 3bef6ba..c699049 100755..100644
--- 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