aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/writefile_spec.lua
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-04-08 22:33:21 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-04-08 22:36:20 -0400
commit0d0eeff8a34b01db93fb271fbeac3ad2d372a0e0 (patch)
tree9ad6ef39f8578c2c22bd0cf3ddd5afeb18bcd9c1 /test/functional/eval/writefile_spec.lua
parentec273a2c6ba055810539f2d58353c9c0fc8db320 (diff)
downloadrneovim-0d0eeff8a34b01db93fb271fbeac3ad2d372a0e0.tar.gz
rneovim-0d0eeff8a34b01db93fb271fbeac3ad2d372a0e0.tar.bz2
rneovim-0d0eeff8a34b01db93fb271fbeac3ad2d372a0e0.zip
eval: add v:_null_string
Replacement for Vim's test_null_string(). Vim uses it to verify that its codebase handles null strings. Preparation for the Test_null_list() in patch v8.2.1822. Use v:_null_string, not non-existent env var, for null string tests. Mention v:_null_string in id() because id(v:_null_string) returns (nil).
Diffstat (limited to 'test/functional/eval/writefile_spec.lua')
-rw-r--r--test/functional/eval/writefile_spec.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/eval/writefile_spec.lua b/test/functional/eval/writefile_spec.lua
index 0bb7523d7e..356680ba7c 100644
--- a/test/functional/eval/writefile_spec.lua
+++ b/test/functional/eval/writefile_spec.lua
@@ -59,6 +59,16 @@ describe('writefile()', function()
eq('\n', read_file(fname))
end)
+ it('writes list with a null string to a file', function()
+ eq(0, exc_exec(
+ ('call writefile([v:_null_string], "%s", "b")'):format(
+ fname)))
+ eq('', read_file(fname))
+ eq(0, exc_exec(('call writefile([v:_null_string], "%s")'):format(
+ fname)))
+ eq('\n', read_file(fname))
+ end)
+
it('appends to a file', function()
eq(nil, read_file(fname))
eq(0, funcs.writefile({'abc', 'def', 'ghi'}, fname))