Add tests with 'vim-flavor'

This commit is contained in:
raimon
2015-11-29 00:05:47 +09:00
parent c260a9f18b
commit 0fa1ba8b7b
9 changed files with 95 additions and 2 deletions

43
t/test_ftdetect.vim Normal file
View File

@@ -0,0 +1,43 @@
filetype plugin on
runtime! plugin/requirements.vim
describe 'enable: requirements#matched_filename()'
it 'to enable file type detection: basic filename'
Expect requirements#matched_filename('requirements.txt') to_be_true
Expect requirements#matched_filename('requires.txt') to_be_true
end
it 'to enable file type detection: pip-tools filename'
Expect requirements#matched_filename('requirements.in') to_be_true
Expect requirements#matched_filename('requires.in') to_be_true
end
it 'to enable file type detection: directory structure'
Expect requirements#matched_filename('requirements/dev.txt') to_be_true
Expect requirements#matched_filename('requires/tests.in') to_be_true
end
end
describe 'disable: requirements#matched_filename()'
it 'to enable file type detection: basic filename'
Expect requirements#matched_filename('requirements.text') to_be_false
end
it 'to enable file type detection: pip-tools filename'
Expect requirements#matched_filename('requirements.ini') to_be_false
end
it 'to enable file type detection: directory structure'
Expect requirements#matched_filename('require/dev.txt') to_be_false
end
end
describe 'g:requirements#detect_filename_pattern'
it 'use g:requirements#detect_filename_pattern'
Expect requirements#matched_filename('freeze.txt') to_be_false
let g:requirements#detect_filename_pattern = 'freeze'
Expect requirements#matched_filename('freeze.txt') to_be_true
end
end
" vim: et sw=4 ts=4 sts=4: