diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-04-08 22:33:21 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-04-08 22:36:20 -0400 |
commit | 0d0eeff8a34b01db93fb271fbeac3ad2d372a0e0 (patch) | |
tree | 9ad6ef39f8578c2c22bd0cf3ddd5afeb18bcd9c1 /test/functional/eval/writefile_spec.lua | |
parent | ec273a2c6ba055810539f2d58353c9c0fc8db320 (diff) | |
download | rneovim-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.lua | 10 |
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)) |