local t = require('test.functional.testutil')() local clear = t.clear local eq = t.eq local eval = t.eval local exec = t.exec local exec_lua = t.exec_lua local expect = t.expect local feed = t.feed local fn = t.fn local api = t.api local source = t.source local command = t.command local exec_capture = t.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 dictionary', 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 dictionary 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