diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-10-14 23:01:53 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-10-14 23:01:53 +0200 |
commit | bbee246aaeb7fb689c7a2ae2bb911e34cabe7b00 (patch) | |
tree | 7fb14a8cb7d7fb1579e46f79ff7c43838dcfbadb /scripts/test | |
parent | 3da600ac3070976142f81025b53dda44d99d44e4 (diff) | |
download | vim-polyglot-bbee246aaeb7fb689c7a2ae2bb911e34cabe7b00.tar.gz vim-polyglot-bbee246aaeb7fb689c7a2ae2bb911e34cabe7b00.zip |
Add and fix tests from upstream vim
Diffstat (limited to '')
-rwxr-xr-x | scripts/test | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/scripts/test b/scripts/test index b87d511c..ae408063 100755 --- a/scripts/test +++ b/scripts/test @@ -1,17 +1,17 @@ #!/usr/bin/env ruby def run_script(src) - system("bash", "-c", src) + if system("bash", "-eo", "pipefail", "-c", src) != true + exit(1) + end end def run_vimscript(src) + wrapper = <<~EOF vim --clean --not-a-term -u <(cat <<- "EOM" - let g:polyglot_test = 1 set nocompatible - let &rtp='$PWD,' . &rtp - filetype plugin indent on - syntax on + let &rtp='#{Dir.pwd},' . &rtp set t_ti= t_te= set shortmess+=F set noswapfile @@ -23,18 +23,36 @@ def run_vimscript(src) endif endfunc EOM + EOF + + wrapper += <<~'EOF' ) -S <(cat <<- "EOM" - try #{src} - catch - echo v:exception - echo v:throwpoint - endtry + + redir @q + silent function /^NewTest_ + redir END + let s:tests = split(substitute(@q, '\(function\|def\) \(\k*()\)', '\2', 'g')) + for test in s:tests + echo test + %bwipe! + exe 'call ' . test + set noinsertmode + if len(v:errors) > 0 + for err in v:errors + echo err + endfor + cq! + endif + endfor + qa! EOM ) | perl -pe 's/\e\[[0-9;]*[a-zA-Z]//g' EOF + wrapper.gsub!('#{src}') { src } + run_script(wrapper) end @@ -47,6 +65,11 @@ EOF run_vimscript('source tests/filetypes.vim') run_vimscript('source tests/extensions.vim') + +if !ENV['DEV'] + run_vimscript('source tests/native.vim') +end + run_script(test_helptags) # run_vimscript(" |