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