test59: Turn function definition into source() call.

This commit is contained in:
Lucas Hoffmann
2015-07-15 09:42:00 +02:00
committed by Björn Linse
parent e60e46596a
commit 144b4954f7

View File

@@ -533,39 +533,41 @@ describe("spell checking with 'encoding' set to utf-8", function()
execute('set fenc=') execute('set fenc=')
-- Function to test .aff/.dic with list of good and bad words. -- Function to test .aff/.dic with list of good and bad words.
execute('func TestOne(aff, dic)') source([[
feed(' set spellfile=<cr>') func TestOne(aff, dic)
feed([[ $put =''<cr>]]) set spellfile=
feed([[ $put ='test '. a:aff . '-' . a:dic<cr>]]) $put =''
-- Generate a .spl file from a .dic and .aff file. $put ='test '. a:aff . '-' . a:dic
feed([[ exe '1;/^' . a:aff . 'affstart/+1,/^' . a:aff . 'affend/-1w! Xtest.aff'<cr>]]) " Generate a .spl file from a .dic and .aff file.
feed([[ exe '1;/^' . a:dic . 'dicstart/+1,/^' . a:dic . 'dicend/-1w! Xtest.dic'<cr>]]) exe '1;/^' . a:aff . 'affstart/+1,/^' . a:aff . 'affend/-1w! Xtest.aff'
feed(' mkspell! Xtest Xtest<cr>') exe '1;/^' . a:dic . 'dicstart/+1,/^' . a:dic . 'dicend/-1w! Xtest.dic'
-- Use that spell file. mkspell! Xtest Xtest
feed(' set spl=Xtest.utf-8.spl spell<cr>') " Use that spell file.
-- List all valid words. set spl=Xtest.utf-8.spl spell
feed(' spelldump<cr>') " List all valid words.
feed(' %yank<cr>') spelldump
feed(' quit<cr>') %yank
feed(' $put<cr>') quit
feed([[ $put ='-------'<cr>]]) $put
-- Find all bad words and suggestions for them. $put ='-------'
feed([[ exe '1;/^' . a:aff . 'good:'<cr>]]) " Find all bad words and suggestions for them.
feed(' normal 0f:]s<cr>') exe '1;/^' . a:aff . 'good:'
feed([[ let prevbad = ''<cr>]]) normal 0f:]s
feed(' while 1<cr>') let prevbad = ''
feed(' let [bad, a] = spellbadword()<cr>') while 1
feed([[ if bad == '' || bad == prevbad || bad == 'badend'<cr>]]) let [bad, a] = spellbadword()
feed(' break<cr>') if bad == '' || bad == prevbad || bad == 'badend'
feed(' endif<cr>') break
feed(' let prevbad = bad<cr>') endif
feed(' let lst = spellsuggest(bad, 3)<cr>') let prevbad = bad
feed(' normal mm<cr>') let lst = spellsuggest(bad, 3)
feed(' $put =bad<cr>') normal mm
feed(' $put =string(lst)<cr>') $put =bad
feed(' normal `m]s<cr>') $put =string(lst)
feed(' endwhile<cr>') normal `m]s
feed('endfunc<cr>') endwhile
endfunc
]])
execute([[call TestOne('1', '1')]]) execute([[call TestOne('1', '1')]])
execute([[$put =soundfold('goobledygoook')]]) execute([[$put =soundfold('goobledygoook')]])