Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbra committed Sep 29, 2023
1 parent f1b26f9 commit 29496b2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ jobs:
tcl-dev \
cscope \
libsodium-dev \
attr \
libattr1-dev
)
fi
sudo apt-get update && sudo apt-get install -y "${PKGS[@]}"
Expand Down
23 changes: 23 additions & 0 deletions src/testdir/test_writefile.vim
Original file line number Diff line number Diff line change
Expand Up @@ -977,4 +977,27 @@ func Test_wq_quitpre_autocommand()
call delete('Xsomefile')
endfunc

func Test_write_with_xattr_support()
CheckLinux
CheckExecutable setfattr

let contents = ["file with xattrs", "line two"]
call writefile(contents, 'Xwattr.txt', 'D')
" write a couple of xattr
call system('setfattr -n user.cookie -v chocolate Xwattr.txt')
call system('setfattr -n user.frieda -v bar Xwattr.txt')
call system('setfattr -n user.empty Xwattr.txt')

set backupcopy=no writebackup& backup&
sp Xwattr.txt
w
$r! getfattr -d %
let expected = ['file with xattrs', 'line two', '# file: Xwattr.txt', 'user.cookie="chocolate"', 'user.empty=""', 'user.frieda="bar"', '']
call assert_equal(expected, getline(1,'$'))

set backupcopy&
bw!

endfunc

" vim: shiftwidth=2 sts=2 expandtab

0 comments on commit 29496b2

Please sign in to comment.