diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-09-23 19:37:50 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-09-23 19:37:58 +0200 |
commit | 33f0964d53270e627e9293a3a7a2badb44353a0b (patch) | |
tree | 7372ececa3d57e4e47da3c21831a35755e637832 /scripts/test | |
parent | 92cb76e33a9ba4d8ac72018a26c2e99ba50d971c (diff) | |
download | vim-polyglot-33f0964d53270e627e9293a3a7a2badb44353a0b.tar.gz vim-polyglot-33f0964d53270e627e9293a3a7a2badb44353a0b.zip |
Update test script to ruby
Diffstat (limited to 'scripts/test')
-rwxr-xr-x | scripts/test | 70 |
1 files changed, 57 insertions, 13 deletions
diff --git a/scripts/test b/scripts/test index 227174d7..db6de5da 100755 --- a/scripts/test +++ b/scripts/test @@ -1,16 +1,60 @@ -#!/bin/bash +#!/usr/bin/env ruby -set -e +def run_script(src) + system("bash", "-c", src) +end -vim --clean -N -u <(echo " - let &rtp='$PWD,'.&rtp - let g:polyglot_test = 1 - source tests/extensions.vim - source tests/filetypes.vim - qa! -") +def run_vimscript(src) + wrapper = <<~EOF + vim --clean --not-a-term -u <(cat <<- "EOM" + let g:polyglot_test = 1 + let &rtp='$PWD,' . &rtp + runtime filetype.vim + set t_ti= t_te= + set shortmess+=F + set noswapfile + set nocp + set nomore + func! Log(msg) + if $DEV != '1' + echo a:msg + else + echon '.' + endif + endfunc + EOM + ) -S <(cat <<- "EOM" + try + #{src} + catch + echo v:exception + echo v:throwpoint + endtry + qa! + EOM + ) | perl -pe 's/\e\[[0-9;]*[a-zA-Z]//g' + EOF -if ! expect -c 'set timeout 1' -c 'spawn vim -N --clean -c "set nomore | :helptags ./doc | q"' -c 'expect "ENTER" { exit 1 }' > /dev/null; then - echo "Please ensure ':helptags ./doc' works properly" - exit 1 -fi + run_script(wrapper) +end + +test_helptags = <<~EOF + if ! expect -c 'set timeout 1' -c 'spawn vim -N --clean -c "set nomore | :helptags ./doc | q"' -c 'expect "ENTER" { exit 1 }' > /dev/null; then + echo "Please ensure ':helptags ./doc' works properly" + exit 1 + fi +EOF + +run_vimscript('source tests/filetypes.vim') +run_vimscript('source tests/extensions.vim') +run_script(test_helptags) + +# run_vimscript(" +# func! TestIndent(file) +# :e a:file +# echo 'ok' +# echo &filetype +# endfunc +# +# #{Dir['tests/indent/**/test.*'].map { |f| "call TestIndent(\"#{f}\")"}.join("\n")} +# ") |