diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-12-03 09:05:20 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-03 09:05:20 +0800 |
| commit | c0840087c83175267667a355131d4dffccfd8ff5 (patch) | |
| tree | be47cfc360ca4f467228d2c900fe5202bd6693a5 /src/nvim/testdir/test_diffmode.vim | |
| parent | 10c50d9f30138e7811789ba1c62f4c520cf04c8f (diff) | |
| parent | 5e97984188e95de419ba5a710a060f0614c6c9e0 (diff) | |
| download | rneovim-c0840087c83175267667a355131d4dffccfd8ff5.tar.gz rneovim-c0840087c83175267667a355131d4dffccfd8ff5.tar.bz2 rneovim-c0840087c83175267667a355131d4dffccfd8ff5.zip | |
Merge pull request #21267 from zeertzjq/vim-8.2.3900
vim-patch:8.2.{3900,partial:3908}: it is not easy to use a script-local function for an option
Diffstat (limited to 'src/nvim/testdir/test_diffmode.vim')
| -rw-r--r-- | src/nvim/testdir/test_diffmode.vim | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index d83cd505a6..0049398776 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -1,4 +1,5 @@ " Tests for diff mode + source shared.vim source screendump.vim source check.vim @@ -681,15 +682,25 @@ func Test_diffexpr() set diffexpr=NewDiffFunc() call assert_fails('windo diffthis', ['E117:', 'E97:']) diffoff! + + " Using a script-local function + func s:NewDiffExpr() + endfunc + set diffexpr=s:NewDiffExpr() + call assert_equal(expand('<SID>') .. 'NewDiffExpr()', &diffexpr) + set diffexpr=<SID>NewDiffExpr() + call assert_equal(expand('<SID>') .. 'NewDiffExpr()', &diffexpr) + %bwipe! set diffexpr& diffopt& + delfunc DiffExpr + delfunc s:NewDiffExpr endfunc func Test_diffpatch() " The patch program on MS-Windows may fail or hang. - if !executable('patch') || !has('unix') - return - endif + CheckExecutable patch + CheckUnix new insert *************** @@ -1250,10 +1261,19 @@ func Test_patchexpr() call assert_equal(2, winnr('$')) call assert_true(&diff) + " Using a script-local function + func s:NewPatchExpr() + endfunc + set patchexpr=s:NewPatchExpr() + call assert_equal(expand('<SID>') .. 'NewPatchExpr()', &patchexpr) + set patchexpr=<SID>NewPatchExpr() + call assert_equal(expand('<SID>') .. 'NewPatchExpr()', &patchexpr) + call delete('Xinput') call delete('Xdiff') set patchexpr& delfunc TPatch + delfunc s:NewPatchExpr %bwipe! endfunc |