summaryrefslogtreecommitdiff
path: root/test/test_writefile_function.vader
diff options
context:
space:
mode:
authortoastal <toastal@protonmail.com>2020-09-08 10:08:00 +0700
committertoastal <toastal@protonmail.com>2020-09-08 10:08:00 +0700
commitf07ecbc579a216a0fff18bdc010fe1a4de91fa39 (patch)
tree13c59e33534ae7b7a79fdf0edaa180222f0ec86b /test/test_writefile_function.vader
parent167e2e77506c55831921ee40dc30c92f7f2aaae8 (diff)
parentb4b75126f9eae30da8f5e0cb9ec100feb38c1cb6 (diff)
downloadale-f07ecbc579a216a0fff18bdc010fe1a4de91fa39.zip
merge master -- apparently someone else added dhall?
Diffstat (limited to 'test/test_writefile_function.vader')
-rw-r--r--test/test_writefile_function.vader46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/test_writefile_function.vader b/test/test_writefile_function.vader
index 811d59e8..53a88331 100644
--- a/test/test_writefile_function.vader
+++ b/test/test_writefile_function.vader
@@ -69,3 +69,49 @@ Execute(Unix file lines should be written as normal):
AssertEqual
\ ['first', 'second', 'third', ''],
\ readfile(g:new_line_test_file, 'b')
+
+Execute(Newline at end of file should be preserved even when nofixeol):
+ call ale#test#SetFilename(g:new_line_test_file)
+
+ setlocal buftype=
+ noautocmd :w
+ noautocmd :e! ++ff=unix
+ set eol
+ set nofixeol
+
+ call ale#util#Writefile(bufnr(''), getline(1, '$'), g:new_line_test_file)
+
+ AssertEqual
+ \ ['first', 'second', 'third', ''],
+ \ readfile(g:new_line_test_file, 'b')
+
+Execute(Newline should not be appended on write when noeol and nofixeol):
+ call ale#test#SetFilename(g:new_line_test_file)
+
+ setlocal buftype=
+ noautocmd :w
+ noautocmd :e! ++ff=unix
+ set noeol
+ set nofixeol
+
+ call ale#util#Writefile(bufnr(''), getline(1, '$'), g:new_line_test_file)
+
+ AssertEqual
+ \ ['first', 'second', 'third'],
+ \ readfile(g:new_line_test_file, 'b')
+
+Execute(Newline should be appended on write when noeol and fixeol):
+ call ale#test#SetFilename(g:new_line_test_file)
+
+ setlocal buftype=
+ noautocmd :w
+ noautocmd :e! ++ff=unix
+ set noeol
+ set fixeol
+
+ call ale#util#Writefile(bufnr(''), getline(1, '$'), g:new_line_test_file)
+
+ AssertEqual
+ \ ['first', 'second', 'third', ''],
+ \ readfile(g:new_line_test_file, 'b')
+