aboutsummaryrefslogtreecommitdiff
path: root/test/functional/editor/xxd_spec.lua
blob: 59521c9a94d823c7b4f97e0b0fe481782e529f93 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
local t = require('test.testutil')
local n = require('test.functional.testnvim')()

local describe, it, before_each = t.describe, t.it, t.before_each
local eq = t.eq
local eval = n.eval
local clear = n.clear
local fn = n.fn
local testprg = n.testprg

describe('xxd', function()
  before_each(clear)

  it('works', function()
    t.skip(t.is_arch('s390x'), 'FIXME: xxd not built correctly on s390x with QEMU?')
    -- Round-trip test: encode then decode should return original
    local input = 'hello'
    local encoded = fn.system({ testprg('xxd') }, input)
    local decoded = fn.system({ testprg('xxd'), '-r' }, encoded)
    eq(input, decoded)
  end)

  it('handles long lines in revert mode', function()
    t.skip(t.is_arch('s390x'), 'FIXME: xxd not built correctly on s390x with QEMU?')
    local long_line = ('4'):rep(512) .. '\n'
    fn.system({ testprg('xxd'), '-r' }, long_line)
    eq(0, eval('v:shell_error'))
  end)
end)