Mercurial > vim
diff src/testdir/test_maparg.vim @ 14700:0a3b9ecf7cb8 v8.1.0362
patch 8.1.0362: cannot get the script line number when executing a function
commit https://github.com/vim/vim/commit/f29c1c6aa3f365c025890fab5fb9efbe88eb1761
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Sep 10 21:05:02 2018 +0200
patch 8.1.0362: cannot get the script line number when executing a function
Problem: Cannot get the script line number when executing a function.
Solution: Store the line number besides the script ID. (Ozaki Kiichi,
closes #3362) Also display the line number with ":verbose set".
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 10 Sep 2018 21:15:07 +0200 |
parents | 4a41a169e5ea |
children | 2dcaa860e3fc |
line wrap: on
line diff
--- a/src/testdir/test_maparg.vim +++ b/src/testdir/test_maparg.vim @@ -13,19 +13,24 @@ function Test_maparg() set cpo-=< set encoding=utf8 " Test maparg() with a string result + let sid = s:SID() + let lnum = expand('<sflnum>') map foo<C-V> is<F4>foo vnoremap <script> <buffer> <expr> <silent> bar isbar - let sid = s:SID() call assert_equal("is<F4>foo", maparg('foo<C-V>')) call assert_equal({'silent': 0, 'noremap': 0, 'lhs': 'foo<C-V>', - \ 'mode': ' ', 'nowait': 0, 'expr': 0, 'sid': sid, 'rhs': 'is<F4>foo', - \ 'buffer': 0}, maparg('foo<C-V>', '', 0, 1)) + \ 'mode': ' ', 'nowait': 0, 'expr': 0, 'sid': sid, 'lnum': lnum + 1, + \ 'rhs': 'is<F4>foo', 'buffer': 0}, + \ maparg('foo<C-V>', '', 0, 1)) call assert_equal({'silent': 1, 'noremap': 1, 'lhs': 'bar', 'mode': 'v', - \ 'nowait': 0, 'expr': 1, 'sid': sid, 'rhs': 'isbar', 'buffer': 1}, + \ 'nowait': 0, 'expr': 1, 'sid': sid, 'lnum': lnum + 2, + \ 'rhs': 'isbar', 'buffer': 1}, \ maparg('bar', '', 0, 1)) + let lnum = expand('<sflnum>') map <buffer> <nowait> foo bar call assert_equal({'silent': 0, 'noremap': 0, 'lhs': 'foo', 'mode': ' ', - \ 'nowait': 1, 'expr': 0, 'sid': sid, 'rhs': 'bar', 'buffer': 1}, + \ 'nowait': 1, 'expr': 0, 'sid': sid, 'lnum': lnum + 1, 'rhs': 'bar', + \ 'buffer': 1}, \ maparg('foo', '', 0, 1)) map abc x<char-114>x