Test: Refactor: Normalize names and behavior

This commit is contained in:
Tinmarino 2020-08-09 16:13:53 -04:00
parent 4b041a606a
commit 7144df6b96
19 changed files with 261 additions and 113 deletions

View File

@ -26,16 +26,17 @@ env:
- VIM_VERSION=vint - VIM_VERSION=vint
- VIM_VERSION=vim_7.3.429 - VIM_VERSION=vim_7.3.429
- VIM_VERSION=nvim_0.3.8 - VIM_VERSION=nvim_0.3.8
# More
- VIM_VERSION=vim_7.4.1099
- VIM_VERSION=vim_7.4.1546
- VIM_VERSION=vim_8.0.0027
- VIM_VERSION=vim_8.1.0519 - VIM_VERSION=vim_8.1.0519
# More
- VIM_VERSION=vim_7.4.1099 PATTERN='[a-k]*.vader'
- VIM_VERSION=vim_7.4.1546 PATTERN='l*.vader'
- VIM_VERSION=vim_8.0.0027 PATTERN='[m-z]*.vader'
script: script:
# Run All tests # Run All tests
- pushd test - pushd test
- if [[ "$VIM_VERSION" == 'vint' ]]; then bash run_tests.sh -v -t vint; - if [[ "$VIM_VERSION" == 'vint' ]]; then bash run_tests.sh -v -t vint;
elif [[ ! -z "$PATTERN" ]]; then bash run_tests.sh -v -t vader -n "$VIM_VERSION" -f "$PATTERN";
else bash run_tests.sh -v -t vader -n "$VIM_VERSION"; else bash run_tests.sh -v -t vader -n "$VIM_VERSION";
fi fi
- popd - popd

View File

@ -77,7 +77,8 @@ Execute (:VimwikiGoto + Completion in directory):
AssertEqual 0, len(l_complete5) AssertEqual 0, len(l_complete5)
Execute (Clean): Execute (Clean):
Log "End: Clean" call DeleteFile("$HOME/testmarkdown/dir1/dir2/test_goto_file.md")
call DeleteFile("$HOME/testmarkdown/index.md")
call system("rm $HOME/testmarkdown/dir1") call system("rm $HOME/testmarkdown/dir1")
# vim: sw=2 foldmethod=indent foldlevel=30 foldignore= # vim: sw=2 foldmethod=indent foldlevel=30 foldignore=

View File

@ -29,5 +29,7 @@ Do (At Index: Create and goto markdownfile):
dd dd
:call DeleteFile('mdfile.md')\<Cr> :call DeleteFile('mdfile.md')\<Cr>
Execute (Clean):
call DeleteFile("$HOME/testmarkdown/index.md")
# vim: sw=2:foldmethod=marker:foldlevel=30:foldignore=: # vim: sw=2:foldmethod=marker:foldlevel=30:foldignore=:

View File

@ -241,6 +241,7 @@ Execute (Edit TestHtml Wiki):
Do (Markdwon with %plainhtml): Do (Markdwon with %plainhtml):
:edit $HOME/testwiki/TestHtml.wiki\<CR> :edit $HOME/testwiki/TestHtml.wiki\<CR>
:normal ggdG\<Cr>
i%plainhtml<div id="test">\<CR> i%plainhtml<div id="test">\<CR>
my paragraph\<CR> my paragraph\<CR>
%plainhtml</div>\<CR>\<Esc> %plainhtml</div>\<CR>\<Esc>

View File

@ -37,7 +37,8 @@ Do (Get RSS feed):
:write :write
Expect (RSS): Expect (RSS):
<?xml version="1.0" encoding="UTF-8" ?> # TODO the next line is deleted with -Es
# <?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>Diary</title> <title>Diary</title>

View File

@ -1,3 +1,8 @@
# Maps
# TODO make it without side effects
# -- Use the normal vimwiki or reset it
# 0 Configure {{{1 # 0 Configure {{{1
################## ##################
@ -26,7 +31,23 @@ Execute (Configure: Set vimwiki list to markdown resource):
let g:vimwiki_ext2syntax = {'.md': 'markdown'} let g:vimwiki_ext2syntax = {'.md': 'markdown'}
Log "Reload vimwiki <- vader_setup.vader" Log "Reload vimwiki <- vader_setup.vader"
call ReloadVimwiki() nmapclear
" UNlet what can be
for i in ['g:vimwiki_commentstring',
\ 'b:did_ftplugin',
\ 'g:loaded_vimwiki',
\ 'g:vimwiki_global_vars',
\ 'g:vimwiki_wikilocal_vars',
\ 'g:vimwiki_syntax_variables',
\ ]
if exists(i)
exe 'unlet ' . i
endif
endfor
" Source plugin: Go
runtime! plugin/vimwiki.vim
Execute (Assert: 2 wiki in Index): Execute (Assert: 2 wiki in Index):
AssertEqual 2, len(vimwiki_wikilocal_vars) AssertEqual 2, len(vimwiki_wikilocal_vars)
@ -304,7 +325,15 @@ Given vimwiki (Completion list #813 {{{3):
Do (Insert a list item and complete): Do (Insert a list item and complete):
Go Go
* comp\<C-n>\<Down>\<Cr> * comp\<C-n>\<C-n>\<Cr>\<Esc>
# -Es -> Delete trailing *
:let mode = mode(1)\<Cr>
:Log 'Mode : ' .mode\<Cr>
:if mode ==# 'ce' || mode ==# 'cv'\<Cr>
try\<Cr>
g/^\* \?$/d\<Cr>
endtry\<Cr>
endif\<Cr>
Expect (With a completion but no new item): Expect (With a completion but no new item):
complete1 complete1

View File

@ -59,4 +59,4 @@ Execute (Search failure message):
redir => output redir => output
silent VimwikiSearch not_exist silent VimwikiSearch not_exist
redir END redir END
Assert match(output, 'VimwikiSearch: No match found.') > -1, "expected custom error" Assert match(output, 'Vimwiki: Search: No match found.') > -1, "expected custom error"

View File

@ -4,11 +4,18 @@
# Thanks to all contributors with issues and pull request on github # Thanks to all contributors with issues and pull request on github
# #
Given vimwiki (a):
a
Execute (Set filename wiki_test.md):
file wiki_test.md
Expect (a):
a
################################################################################ ################################################################################
Execute (Log): Execute (Log):
Log '#915 Vimwiki Markdown Blockquote Syntax issue' Log '#915 Vimwiki Markdown Blockquote Syntax issue'
file wiki_test.md
call SetSyntax('markdown') call SetSyntax('markdown')
Given vimwiki (One blockquote): Given vimwiki (One blockquote):
@ -46,7 +53,6 @@ Execute (no JJ && Assert for Version > 7.3):
################################################################################ ################################################################################
Execute (Log): Execute (Log):
Log '#949 <Enter> create link bug with Chinese characters' Log '#949 <Enter> create link bug with Chinese characters'
file wiki_test.md
call SetSyntax('markdown') call SetSyntax('markdown')
Given vimwiki (Madarin with vimwiki Yeeepy): Given vimwiki (Madarin with vimwiki Yeeepy):
@ -101,7 +107,6 @@ Expect (Renumber all):
################################################################################ ################################################################################
Execute (Log): Execute (Log):
Log '#899 conceallevel is setted globally when editing a wiki file (PR #900)' Log '#899 conceallevel is setted globally when editing a wiki file (PR #900)'
file wiki_test.md
call SetSyntax('markdown') call SetSyntax('markdown')
Given vimwiki (Void): Given vimwiki (Void):
@ -163,3 +168,10 @@ Do (No link: <CR><CR>):
:call vimwiki#vars#set_global('markdown_create_link', 0) :call vimwiki#vars#set_global('markdown_create_link', 0)
\<CR>\<CR> \<CR>\<CR>
:AssertEqual expand('%:t'), 'main.md'\<CR> :AssertEqual expand('%:t'), 'main.md'\<CR>
Expect (Link):
[Link](Link)
Execute (wipeout):
" This solves many things
file /testplugin/[Vader-workbench]

View File

@ -0,0 +1,51 @@
# See Issue #580
Given vimwiki (Void):
Tabnext
Execute (Set fold method):
let g:vimwiki_folding = 'expr:quick'
call ReloadVimwiki()
Execute (Expect < 0.5 second delay: Issue #580):
let mode = mode(1)
Log 'Mode : ' .mode
if mode ==# 'ce' || mode ==# 'cv' " -es (silent ex mode)
Log 'Skiped: Tabedit and tabnext are not working weel with -Es'
else
Log 'Prepare: Edit: mode: ' . mode
edit /testplugin/test/resources/delay.wiki
Log 'Prepare: Assert'
AssertEqual 'default', vimwiki#vars#get_wikilocal('syntax')
Log 'Prepare: Goto 50%'
normal! 50%
# "TODO set ft and set wiki syntax or this error (no fold found)
# "normal! zozo
Log 'Run: tabedit'
let start = reltime()
tabedit
let end = str2float(reltimestr(reltime(start)))
Log 'Verify redraw'
Log 'Elapsed time Tabedit = ' . string(end)
Assert end < 0.5, 'Redraw Took longer than expected: ' . string(end) . ' seconds'
Log 'Run: redraw'
let start = reltime()
tabprev
redraw
let end = str2float(reltimestr(reltime(start)))
Log 'Verify redraw'
Log 'Elapsed time redraw = ' . string(end)
Assert end < 0.5, 'Redraw Took longer than expected: ' . string(end) . ' seconds'
endif
Execute (Reset variables):
call DeleteFile('/testplugin/test/resources/delay.wiki')
let g:vimwiki_folding = ''
call ReloadVimwiki()
Expect vimwiki (Tabnext):
Tabnext

View File

@ -72,6 +72,8 @@ Do (Enter link):
A__HERE3__\<Esc> A__HERE3__\<Esc>
ggjjj\<Cr> ggjjj\<Cr>
A__HERE4__\<Esc> A__HERE4__\<Esc>
:AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')\<Cr>
Expect vimwiki (Good anchor with link navigation): Expect vimwiki (Good anchor with link navigation):
[A link B](#a-link-b) [A link B](#a-link-b)
@ -299,7 +301,7 @@ Expect (Just Contents/test1 got the second shot):
- [filenew](filenew) first shot - [filenew](filenew) first shot
Execute (Delete filenew buffer): Execute (Delete filenew buffer):
bd! /testplugin/filenew.md call DeleteFile('/testplugin/filenew.md')
Do (Navigate with <Tab> comeback with <Bs> too far): Do (Navigate with <Tab> comeback with <Bs> too far):
\<Tab> \<Tab>

View File

@ -200,6 +200,11 @@ Do (Check in_tmp):
jj\<Cr> jj\<Cr>
:AssertEqual expand('%'), '/tmp/in_tmp.wiki'\<Cr> :AssertEqual expand('%'), '/tmp/in_tmp.wiki'\<Cr>
Execute(Clean: temporary):
call ReloadVimwiki()
call DeleteFile('$HOME/in_home1.md')
call DeleteFile('~/in_home2.md')
call DeleteFile('/tmp/in_tmp.md')
# Link with dot {{{1 # Link with dot {{{1
#################### ####################
@ -368,4 +373,7 @@ Expect (Mediawiki links):
[[file.md]] [[file.md]]
[[file.mw]] [[file.mw]]
Execute(Clean: Icreated many temporary wiki):
call ReloadVimwiki()
# vim: foldmethod=marker foldlevel=30 # vim: foldmethod=marker foldlevel=30

View File

@ -7,6 +7,7 @@
Execute (Copy Wiki's Resources): Execute (Copy Wiki's Resources):
Log "Start: Copy Resources" Log "Start: Copy Resources"
call CopyResources() call CopyResources()
set sw=8
# 1 VimwikiGenerateLinks {{{1 # 1 VimwikiGenerateLinks {{{1
########################## ##########################
@ -195,7 +196,7 @@ Expect (diary index generated):
Execute (Clean): Execute (Clean):
Log "End: Clean" call DeleteFile("$HOME/testmarkdown/index.md")
call DeleteFile('$HOME/testmarkdown/diary/2019-12-10.md') call DeleteFile('$HOME/testmarkdown/diary/2019-12-10.md')
call DeleteFile('$HOME/testmarkdown/diary/2019-07-13.md') call DeleteFile('$HOME/testmarkdown/diary/2019-07-13.md')
call DeleteFile('$HOME/testmarkdown/diary/2019-03-01.md') call DeleteFile('$HOME/testmarkdown/diary/2019-03-01.md')

View File

@ -36,10 +36,21 @@ Execute (Create 3 files):
Do (Testing Old buffer has been wiped out {{{2): Do (Testing Old buffer has been wiped out {{{2):
:edit $HOME/testmarkdown/Test-Rename-Completion.md\<Cr> :edit $HOME/testmarkdown/Test-Rename-Completion.md\<Cr>
:Log 'Get current Buffer'\<Cr>
:let buf_old = bufnr('%')\<Cr> :let buf_old = bufnr('%')\<Cr>
:Log 'Is this wiki 2'\<Cr>
:AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')\<Cr>
:Log 'Delete for loosers'\<Cr>
:call DeleteFile('$HOME/testmarkdown/Test-Rename-new1.md')\<Cr>
:Log 'Rewrite ...'\<Cr>
:call WriteMe()\<Cr>
:Log 'Rename 1'\<Cr>
:VimwikiRenameFile Test-Rename-new1\<Cr> :VimwikiRenameFile Test-Rename-new1\<Cr>
:Log 'Assert 1'\<Cr>
:AssertEqual 'Test-Rename-new1', expand('%:t:r')\<Cr> :AssertEqual 'Test-Rename-new1', expand('%:t:r')\<Cr>
:Log 'Rename 2'\<Cr>
:VimwikiRenameFile Test-Rename-Completion\<Cr> :VimwikiRenameFile Test-Rename-Completion\<Cr>
:Log 'Assert 2'\<Cr>
:AssertEqual expand('%'), $HOME . '/testmarkdown/Test-Rename-Completion.md'\<Cr> :AssertEqual expand('%'), $HOME . '/testmarkdown/Test-Rename-Completion.md'\<Cr>
Do (Testing Completion {{{2): Do (Testing Completion {{{2):
@ -83,6 +94,7 @@ Do (Testing transforward {{{2):
Execute (Delete smaller unit changed {{{2): Execute (Delete smaller unit changed {{{2):
call DeleteFile('$HOME/testmarkdown/Test-Rename-new1.md')
call DeleteFile('$HOME/testmarkdown/Test-Rename-zzz.md') call DeleteFile('$HOME/testmarkdown/Test-Rename-zzz.md')
call DeleteFile('$HOME/testmarkdown/dir1/Test-Rename-Completion_2.md') call DeleteFile('$HOME/testmarkdown/dir1/Test-Rename-Completion_2.md')
call DeleteFile('$HOME/testmarkdown/dir1/Test-Rename-2.md') call DeleteFile('$HOME/testmarkdown/dir1/Test-Rename-2.md')

View File

@ -5,6 +5,7 @@
# Say Hi # Say Hi
echo -en "Starting $(basename $0) for VimWiki\n" echo -en "Starting $(basename $0) for VimWiki\n"
start_time=`date +%s`
# For windows: Cmder bash is appending busybox to the path and # For windows: Cmder bash is appending busybox to the path and
# and a smlll vim is included, so that override the windows path vim # and a smlll vim is included, so that override the windows path vim
@ -28,8 +29,8 @@ printHelp() {
separating versions with a space. E.g. -n "vim1 vim2". separating versions with a space. E.g. -n "vim1 vim2".
Default is all available versions. Default is all available versions.
-f (File) Comma seperated list of tests to run. -f (File) Space separated list of tests to run.
E.g. -o "list_margin,command_toc" E.g. -o "list_* z_success"
-l (List) list available versions that can be used with the '-n' option -l (List) list available versions that can be used with the '-n' option
@ -38,7 +39,7 @@ printHelp() {
-v (Verbose) Turn on verbose output. -v (Verbose) Turn on verbose output.
E.g. On Linux E.g. On Linux
bash run_tests.sh -v -t vader -n "vim_7.4.1099 vim_8.1.0519" -f link_creation.vader,issue_markdown.vader bash run_tests.sh -v -t vader -n "vim_7.4.1099 vim_8.1.0519" -f link_creation.vader issue_markdown.vader
E.g. On Windows E.g. On Windows
bash run_tests.sh -v -t vader -n local -f z_success.vader | cat bash run_tests.sh -v -t vader -n local -f z_success.vader | cat
EOF EOF
@ -59,12 +60,16 @@ runVader() {
# Parse tests files to execute # Parse tests files to execute
if [[ -z $file_test ]]; then if [[ -z $file_test ]]; then
ind="test/independent_runs/*.vader" ind="test/independent_runs/*.vader"
res="test/*" res="test/*"
else else
IFS=',' read -ra TEST <<< "$file_test" read -ra TEST <<< "$file_test"
for i in "${TEST[@]}"; do for i in "${TEST[@]}"; do
if [[ -f "$i" ]]; then if [[ "$i" == "independent_runs/"*"*"* ]]; then
ind="$ind test/${i}"
elif [[ "$i" == *"*"* ]]; then
res="$res test/${i}"
elif [[ -f "$i" ]]; then
res="$res test/${i}" res="$res test/${i}"
elif [[ -f "${i}.vader" ]]; then elif [[ -f "${i}.vader" ]]; then
res="$res test/${i}.vader" res="$res test/${i}.vader"
@ -77,11 +82,11 @@ runVader() {
fi fi
done done
fi fi
echo "Vader: will run files: $res and independently $ind"
# Run tests for each specified version # Run tests for each specified version
for v in $vers; do for v in $vers; do
echo -e "\nRunning version: $v" echo -e "\n\nRunning version: $v"
echo -e "============================="
# Set local environment variables # Set local environment variables
if [[ "$v" == "local" ]]; then if [[ "$v" == "local" ]]; then
@ -98,15 +103,24 @@ runVader() {
export ROOT="$tmp_dir/vader_wiki/" export ROOT="$tmp_dir/vader_wiki/"
export HOME="$tmp_dir/vader_wiki/home" export HOME="$tmp_dir/vader_wiki/home"
vim="vim" vim="vim"
vim_opt="-u ~/test/vimrc -i NONE" vim_opt="-u ~/test/vimrc"
else else
# Only set dockerized vars # Only set dockerized vars
export ROOT="/" # So no if in vimrc export ROOT="/" # So no if in vimrc
vim="/vim-build/bin/$v" vim="/vim-build/bin/$v"
vim_opt="-u test/vimrc -i NONE" vim_opt="-u test/vimrc"
fi fi
set -o pipefail # Too talkative TODO make a verbose level 1..10 an 1 is not taking vim
#if [[ "$verbose" != 0 ]]; then
# vim_opt+=' -V1'
#fi
# IDK why vim with -Es is returning ! and make fail:
# -- tabnext profiling
# -- map.vim
vim_opt+=' -i NONE -Es '
# set -o pipefail
# Copy the resources to temporary directory # Copy the resources to temporary directory
if [[ "$v" == "local" ]]; then if [[ "$v" == "local" ]]; then
@ -124,41 +138,50 @@ runVader() {
fi fi
# Run batch of tests # Run batch of tests
if [[ "$v" == "local" ]]; then if [[ "$res" != "" ]]; then
pushd $tmp_dir/vader_wiki/testplugin if [[ "$v" == "local" ]]; then
pushd $tmp_dir/vader_wiki/testplugin
# Run the tests # Run the tests
echo -e "\nStarting vim with Vader" echo -e "\nStarting Batch Vim/Vader <- $res"
"$vim" $vim_opt "+Vader! ${res}" 2>&1 "$vim" $vim_opt "+Vader! ${res}" 2>&1
err=$(( $err | $? )) ret=${PIPESTATUS[1]}; err=$(( $err + $ret ))
echo -e "\nReturned Batch Vim/Vader -> $ret"
popd popd
else # In docker else
echo -e "\nStarting docker with vim with Vader" # In docker
docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \ echo -e "\nStarting Independant Vim/Vader <- $res"
"$v" $vim_opt "+Vader! ${res}" 2>&1 | vader_filter | vader_color docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \
err=$(( $err | $? )) "$v" $vim_opt "+Vader! ${res}" 2>&1 | vader_filter | vader_color
ret=${PIPESTATUS[1]}; err=$(( $err + $ret ))
echo -e "\nReturned Independant Docker/Vim/Vader -> $ret"
fi
fi fi
# Run Tests that must be run in individual vim instances # Run Tests that must be run in individual vim instances
# see README.md for more information # see README.md for more information
test_cmd="for VF in ${ind}; do $vim $vim_opt \"+Vader! \$VF\"; done" if [[ "$ind" != "" ]]; then
if [[ "$v" == "local" ]]; then test_cmd="for VF in ${ind}; do $vim $vim_opt \"+Vader! \$VF\"; done"
pushd $tmp_dir/vader_wiki/testplugin if [[ "$v" == "local" ]]; then
pushd $tmp_dir/vader_wiki/testplugin
echo "Starting vim with Vader" echo -e "\nStarting Vim/Vader <- $test_cmd"
bash -c "$test_cmd" 2>&1 bash -c "$test_cmd" 2>&1
err=$(( $err | $? )) ret=${PIPESTATUS[1]}; err=$(( $err + $ret ))
echo -e "\nReturned Vim/Vader -> $ret"
popd popd
else # In docker else # In docker
echo "Starting docker with vim with Vader" echo -e "\nStarting Docker/Vim/Vader <- $test_cmd"
docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \ docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \
/bin/bash -c "$test_cmd" 2>&1 | vader_filter | vader_color /bin/bash -c "$test_cmd" 2>&1 | vader_filter | vader_color
err=$(( $err | $? )) ret=${PIPESTATUS[1]}; err=$(( $err + $ret ))
echo -e "\nReturned Docker/Vim/Vader -> $ret"
fi
fi fi
set +o pipefail #set +o pipefail
# Restore what must (I know it should be refactored in a while) # Restore what must (I know it should be refactored in a while)
if [[ "$v" == "local" ]]; then if [[ "$v" == "local" ]]; then
@ -186,43 +209,44 @@ runVint() {
} }
getVers() { getVers() {
# Get all possible version <- Dockerfile
sed -n 's/.* -name \([^ ]*\) .*/\1/p' ../Dockerfile sed -n 's/.* -name \([^ ]*\) .*/\1/p' ../Dockerfile
} }
vader_filter() { vader_filter() {
# Filter Vader Stdout # Filter Vader Stdout
local err=0 local err=0
while read -r; do # Keep indentation
local IFS=''
while read -r REPLY; do
# Print only possible error cases # Print only possible error cases
if [[ "$verbose" == 0 ]]; then if [[ "$REPLY" = *'docker:'* ]] || \
if [[ "$REPLY" = *'docker:'* ]] || \ [[ "$REPLY" = *'Starting Vader:'* ]] || \
[[ "$REPLY" = *'Starting Vader:'* ]] || \ [[ "$REPLY" = *'Vader error:'* ]] || \
[[ "$REPLY" = *'Vader error:'* ]] || \ [[ "$REPLY" = *'Vim: Error '* ]]; then
[[ "$REPLY" = *'Vim: Error '* ]]; then echo "$REPLY"
echo "$REPLY" elif [[ "$REPLY" = *'[EXECUTE] (X)'* ]] || \
elif [[ "$REPLY" = *'[EXECUTE] (X)'* ]] || \ [[ "$REPLY" = *'[ EXPECT] (X)'* ]]; then
[[ "$REPLY" = *'[ EXPECT] (X)'* ]]; then echo "$REPLY"
echo "$REPLY" err=1
elif [[ "$REPLY" = *'Success/Total:'* ]]; then
success="$(echo -n "$REPLY" | grep -o '[0-9]\+/' | head -n1 | cut -d/ -f1)"
total="$(echo -n "$REPLY" | grep -o '/[0-9]\+' | head -n1 | cut -d/ -f2)"
if [ "$success" -lt "$total" ]; then
err=1 err=1
elif [[ "$REPLY" = *'Success/Total:'* ]]; then
success="$(echo -n "$REPLY" | grep -o '[0-9]\+/' | head -n1 | cut -d/ -f1)"
total="$(echo -n "$REPLY" | grep -o '/[0-9]\+' | head -n1 | cut -d/ -f2)"
if [ "$success" -lt "$total" ]; then
err=1
fi
echo "$REPLY"
fi fi
else echo "$REPLY"
elif [[ "$verbose" != 0 ]]; then
# just print everything # just print everything
echo "$REPLY" echo "$REPLY"
fi fi
done done
if [[ "$err" == 1 ]]; then if [[ "$err" == 1 ]]; then
echo "" echo -e "\033[0;31m"
echo "!---------Failed tests detected---------!" echo -e "!---------Failed tests detected---------!"
echo "Run with the '-v' flag for verbose output" echo -e "Run with the '-v' flag for verbose output"
echo "" echo -e "\033[0m"
fi fi
return $err return $err
} }
@ -329,24 +353,24 @@ trap exit 1 SIGINT SIGTERM
# Global error return of the script # Global error return of the script
o_error=0 o_error=0
# select which tests should run # Select which tests should run
case $type in case $type in
"vader" ) "vader" )
runVader ; err=$? runVader ; err=$?
echo "Vader: returned $err" echo "Main Vader: returned $err"
o_error=$(( $err | $o_error )) o_error=$(( $err | $o_error ))
;; ;;
"vint" ) "vint" )
runVint ; err=$? runVint ; err=$?
echo "Vint: returned $err" echo "Main Vint: returned $err"
o_error=$(( $err | $o_error )) o_error=$(( $err | $o_error ))
;; ;;
"all" ) "all" )
runVint ; err=$? runVint ; err=$?
echo "Vint: returned $err" echo "Main Vint: returned $err"
o_error=$(( $err | $o_error )) o_error=$(( $err | $o_error ))
runVader ; err=$? runVader ; err=$?
echo "Vader: returned $err" echo "Main Vader: returned $err"
o_error=$(( $err | $o_error )) o_error=$(( $err | $o_error ))
;; ;;
* ) * )
@ -354,6 +378,11 @@ case $type in
exit 1 exit 1
esac esac
# Calcultate time
end_time=`date +%s`
sec_time=$((end_time - start_time))
printf -v script_time '%dh:%dm:%ds' $(($sec_time/3600)) $(($sec_time%3600/60)) $(($sec_time%60))
# Exit # Exit
echo "Script $(basename $0) exiting: $o_error" echo -ne "Script $(basename $0), in $script_time, Returned -> $o_error\n\n"
exit $o_error exit $o_error

View File

@ -1,30 +0,0 @@
# See Issue #580
Execute (Set fold method):
let g:vimwiki_folding = 'expr:quick'
call ReloadVimwiki()
Execute (Expect < 0.5 second delay: Issue #580):
" prep
edit test/resources/delay.wiki
normal! 50%
# TODO set ft and set wiki syntax or this error (no fold found)
# normal! zozo
tabedit
" run test
let start = reltime()
tabprev
redraw
let end = str2float(reltimestr(reltime(start)))
" cleanup
bdelete test/resources/delay.wiki
" verify
Log 'Elapsed time = ' . string(end)
Assert end < 0.5, 'Took longer than expected: ' . string(end) . ' seconds'
Execute (Reset variables):
let g:vimwiki_folding = ''
call ReloadVimwiki()

View File

@ -1,9 +1,18 @@
" TODO treat if local (see $HOME in all tests)
" TODO mutualise call CopyResources()
" TODO mutualise (to prettify output) mode(1) to check if in -Es or not
" TODO test tabnext in at least one travis job (without -Es)
" TODO (idea) fasten travis difefrent job with the same vimwiki git (-8s)
" Declare tipical Vim preambule " Declare tipical Vim preambule
" vint: -ProhibitSetNoCompatible " vint: -ProhibitSetNoCompatible
set nocompatible set nocompatible
filetype plugin indent on filetype plugin indent on
syntax enable syntax enable
" Usefull var: for one day, making tests on local
let $TPLUGIN = '/testplugin'
let $THOME = $HOME
" Set chrooted virtual runtime path " Set chrooted virtual runtime path
let rtp=$ROOT.'/rtp.vim' let rtp=$ROOT.'/rtp.vim'
@ -43,9 +52,12 @@
" Register the 3 wikis " Register the 3 wikis
let g:vimwiki_list = [vimwiki_default, vimwiki_markdown, vimwiki_mediawiki] let g:vimwiki_list = [vimwiki_default, vimwiki_markdown, vimwiki_mediawiki]
let g:vimwiki_list_vimrc = [vimwiki_default, vimwiki_markdown, vimwiki_mediawiki]
" Set basic settings " Set basic settings
" Avoid more prompt
set nomore
set backspace=indent,eol,start set backspace=indent,eol,start
set wildmode=longest:full,full set wildmode=longest:full,full
set wildmenu set wildmenu
@ -119,8 +131,24 @@
" this is needed if running manually multiple times " this is needed if running manually multiple times
nmapclear nmapclear
unlet g:loaded_vimwiki " UNlet what can be
source plugin/vimwiki.vim for i in ['g:vimwiki_commentstring',
\ 'b:did_ftplugin',
\ 'g:loaded_vimwiki',
\ 'g:vimwiki_global_vars',
\ 'g:vimwiki_wikilocal_vars',
\ 'g:vimwiki_syntax_variables',
\ ]
if exists(i)
exe 'unlet ' . i
endif
endfor
" Reset list
let g:vimwiki_list = g:vimwiki_list_vimrc
" Source plugin: Go
runtime! plugin/vimwiki.vim
endfunction endfunction
function! ReloadVars() function! ReloadVars()
@ -165,7 +193,7 @@
catch | endtry catch | endtry
" Delete Buffer " Delete Buffer
try try
execute 'bdelete! ' . path execute 'bwipeout! ' . path
catch | endtry catch | endtry
endfunction endfunction