robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
f907614088
master
1local t =require ( 'test.testutil' ) 2local n =require ( 'test.functional.testnvim' )() 3 4local describe , it , before_each =t . describe , t . it , t . before_each 5local exec_lua =n . exec_lua 6local eq =t . eq 7 8local function md_to_vimdoc ( text , start_indent , indent , text_width ) 9return exec_lua ( 10[[ 11local text, start_indent, indent, text_width = ... 12start_indent = start_indent or 0 13indent = indent or 0 14text_width = text_width or 70 15local util = require('src/gen/util') 16return util.md_to_vimdoc(table.concat(text, '\n'), start_indent, indent, text_width) 17]] , 18text , 19start_indent , 20indent , 21text_width 22) 23end 24 25local function test ( what , act , exp , ... ) 26local argc , args =select ( '#' , ... ), { ... } 27it ( what , function () 28eq ( table . concat ( exp , '\n' ), md_to_vimdoc ( act , unpack ( args , 1 , argc ))) 29end ) 30end 31 32describe ( 'md_to_vimdoc' , function () 33before_each ( function () 34n . clear () 35end ) 36 37test ( 'can render para after fenced code' , { 38'- Para1' , 39' ```' , 40' code' , 41' ```' , 42' Para2' , 43} , { 44'• Para1 >' , 45' code' , 46'<' , 47' Para2' , 48'' , 49} ) 50 51test ( 'start_indent only applies to first line' , { 52'para1' , 53'' , 54'para2' , 55} , { 56'para1' , 57'' , 58' para2' , 59'' , 60} , 0 , 10 , 78 ) 61 62test ( 'inline 1' , { '(`string`)' } , { '(`string`)' , '' } ) 63end )