aboutsummaryrefslogtreecommitdiff
path: root/test/functional/script/text_utils_spec.lua
blob: c429d306d530b54a4dbddb5160a17b299c51ff16 (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
30
31
32
33
34
35
36
37
38
39
local helpers = require('test.functional.helpers')(after_each)
local exec_lua = helpers.exec_lua
local eq = helpers.eq

local function md_to_vimdoc(text)
  return exec_lua(
    [[
    local text_utils = require('scripts/text_utils')
    return text_utils.md_to_vimdoc(table.concat(..., '\n'), 0, 0, 70)
  ]],
    text
  )
end

local function test(act, exp)
  eq(table.concat(exp, '\n'), md_to_vimdoc(act))
end

describe('md_to_vimdoc', function()
  before_each(function()
    helpers.clear()
  end)

  it('can render para after fenced code', function()
    test({
      '- Para1',
      '  ```',
      '  code',
      '  ```',
      '  Para2',
    }, {
      '• Para1 >',
      '    code',
      '<',
      '  Para2',
      '',
    })
  end)
end)