local t = require('test.testutil') local n = require('test.functional.testnvim')() local clear = n.clear local eq = t.eq local eval = n.eval local exec = n.exec local exec_lua = n.exec_lua local expect = n.expect local feed = n.feed local fn = n.fn local api = n.api local source = n.source local command = n.command local exec_capture = n.exec_capture local pcall_err = t.pcall_err describe('maparg()', function() before_each(clear) local foo_bar_map_table = { lhs = 'foo', lhsraw = 'foo', script = 0, silent = 0, rhs = 'bar', expr = 0, sid = 0, scriptversion = 1, buffer = 0, nowait = 0, mode = 'n', mode_bits = 0x01, abbr = 0, noremap = 1, lnum = 0, } it('returns a dict', function() command('nnoremap foo bar') eq('bar', fn.maparg('foo')) eq(foo_bar_map_table, fn.maparg('foo', 'n', false, true)) end) it('returns 1 for silent when is used', function() command('nnoremap foo bar') eq(1, fn.maparg('foo', 'n', false, true)['silent']) command('nnoremap baz bat') eq(0, fn.maparg('baz', 'n', false, true)['silent']) end) it('returns an empty string when no map is present', function() eq('', fn.maparg('not a mapping')) end) it('returns an empty dict when no map is present and dict is requested', function() eq({}, fn.maparg('not a mapping', 'n', false, true)) end) it('returns the same value for noremap and