robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
410be968d5
master
1" Test spell checking 2 3source check.vim 4CheckFeature spell 5 6" Test spellbadword() with argument, specifically to move to "rare" words 7" in normal mode. 8func Test_spellrareword () 9set spell 10 11" Create a small word list to test that spellbadword('...') 12" can return ['...', 'rare']. 13let lines =<< trim END 14foo 15foobar/? 16foobara/? 17END 18call writefile ( lines , 'Xwords' , 'D' ) 19 20mkspell ! Xwords.spl Xwords 21set spelllang = Xwords.spl 22call assert_equal ([ 'foobar' , 'rare' ], spellbadword ( 'foo foobar' )) 23 24new 25call setline ( 1 , [ 'foo' , '' , 'foo bar foo bar foobara foo foo foo foobar' , '' , 'End' ]) 26set spell wrapscan 27normal ]s 28call assert_equal ( 'foo' , expand ( '<cword>' )) 29normal ]s 30call assert_equal ( 'bar' , expand ( '<cword>' )) 31 32normal ]r 33call assert_equal ( 'foobara' , expand ( '<cword>' )) 34normal ]r 35call assert_equal ( 'foobar' , expand ( '<cword>' )) 36normal ]r 37call assert_equal ( 'foobara' , expand ( '<cword>' )) 38normal 2]r 39call assert_equal ( 'foobara' , expand ( '<cword>' )) 40 41normal [r 42call assert_equal ( 'foobar' , expand ( '<cword>' )) 43normal [r 44call assert_equal ( 'foobara' , expand ( '<cword>' )) 45normal [r 46call assert_equal ( 'foobar' , expand ( '<cword>' )) 47normal 2[r 48call assert_equal ( 'foobar' , expand ( '<cword>' )) 49 50bwipe ! 51set nospell 52 53call delete ( 'Xwords.spl' ) 54set spelllang & 55set spell & 56 57" set 'encoding' to clear the word list 58set encoding = utf-8 59endfunc 60 61" vim: shiftwidth=2 sts=2 expandtab