robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
f907614088
master
1local t =require ( 'test.testutil' ) 2local n =require ( 'test.functional.testnvim' )() 3local Screen =require ( 'test.functional.ui.screen' ) 4 5local describe , it , before_each =t . describe , t . it , t . before_each 6local clear =n . clear 7local eq =t . eq 8local api =n . api 9local fn =n . fn 10local exec =n . exec 11local feed =n . feed 12 13describe ( 'oldtests' , function () 14before_each ( clear ) 15 16local exec_lines =function ( str ) 17return fn . split ( fn . execute ( str ), '\n' ) 18end 19 20local add_an_autocmd =function () 21exec [[ 22augroup vimBarTest 23au BufReadCmd * echo 'hello' 24augroup END 25]] 26 27eq ( 3 , # exec_lines ( 'au vimBarTest' )) 28eq ( 1 , # api . nvim_get_autocmds ( { group ='vimBarTest' } )) 29end 30 31it ( 'should recognize a bar before the {event}' , function () 32-- Good spacing 33add_an_autocmd () 34exec [[ augroup vimBarTest | au! | augroup END ]] 35eq ( 1 , # exec_lines ( 'au vimBarTest' )) 36eq ( {} , api . nvim_get_autocmds ( { group ='vimBarTest' } )) 37 38-- Sad spacing 39add_an_autocmd () 40exec [[ augroup vimBarTest| au!| augroup END ]] 41eq ( 1 , # exec_lines ( 'au vimBarTest' )) 42 43-- test that a bar is recognized after the {event} 44add_an_autocmd () 45exec [[ augroup vimBarTest| au!BufReadCmd| augroup END ]] 46eq ( 1 , # exec_lines ( 'au vimBarTest' )) 47 48add_an_autocmd () 49exec [[ au! vimBarTest|echo 'hello' ]] 50eq ( 1 , # exec_lines ( 'au vimBarTest' )) 51end ) 52 53-- oldtest: Test_delete_ml_get_errors() 54it ( 'no ml_get error with TextChanged autocommand and delete' , function () 55local screen =Screen . new ( 75 , 10 ) 56screen : add_extra_attr_ids { 57[ 100 ] ={ background =Screen . colors . Cyan1 } , 58} 59exec ( [[ 60set noshowcmd noruler scrolloff=0 61source test/old/testdir/samples/matchparen.vim 62edit test/old/testdir/samples/box.txt 63]] ) 64feed ( '249GV<C-End>d' ) 65screen : expect ( [[ 66const auto themeEmoji = _forPeer->themeEmoji(); | 67if (themeEmoji.isEmpty()) { | 68return nonCustom; | 69} | 70const auto &themes = _forPeer->owner().cloudThemes(); | 71const auto theme = themes.themeForEmoji(themeEmoji); | 72if (!theme) {100:{} | 73return nonCustom; | 74{100:^}} | 75353 fewer lines | 76]] ) 77feed ( '<PageUp>' ) 78screen : expect ( [[ 79| 80auto BackgroundBox::Inner::resolveResetCustomPaper() const | 81-> std::optional<Data::WallPaper> { | 82if (!_forPeer) { | 83return {}; | 84} | 85const auto nonCustom = Window::Theme::Background()->paper(); | 86const auto themeEmoji = _forPeer->themeEmoji(); | 87^if (themeEmoji.isEmpty()) { | 88353 fewer lines | 89]] ) 90end ) 91end )