robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
f907614088
master
1-- Tests for complicated + argument to :edit command 2 3local n =require ( 'test.functional.testnvim' )() 4local t =require ( 'test.testutil' ) 5 6local describe , it , setup , teardown =t . describe , t . it , t . setup , t . teardown 7local clear , insert =n . clear , n . insert 8local command , expect =n . command , n . expect 9local poke_eventloop =n . poke_eventloop 10 11describe ( ':edit' , function () 12setup ( clear ) 13 14it ( 'is working' , function () 15insert ( [[ 16The result should be in Xfile1: "fooPIPEbar", in Xfile2: "fooSLASHbar" 17foo|bar 18foo/bar]] ) 19poke_eventloop () 20 21-- Prepare some test files 22command ( '$-1w! Xfile1' ) 23command ( '$w! Xfile2' ) 24command ( 'w! Xfile0' ) 25 26-- Open Xfile using '+' range 27command ( 'edit +1 Xfile1' ) 28command ( 's/|/PIPE/' ) 29command ( 'yank A' ) 30command ( 'w! Xfile1' ) 31 32-- Open Xfile2 using '|' range 33command ( 'edit Xfile2|1' ) 34command ( 's/\\//SLASH/' ) 35command ( 'yank A' ) 36command ( 'w! Xfile2' ) 37 38-- Clean first buffer and put @a 39command ( 'bf' ) 40command ( '%d' ) 41command ( '0put a' ) 42 43-- Remove empty line 44command ( '$d' ) 45 46-- The buffer should now contain 47expect ( [[ 48fooPIPEbar 49fooSLASHbar]] ) 50end ) 51 52teardown ( function () 53os . remove ( 'Xfile0' ) 54os . remove ( 'Xfile1' ) 55os . remove ( 'Xfile2' ) 56end ) 57end )