From 7144df6b96cc37defaa2b08a39f5b41a87614939 Mon Sep 17 00:00:00 2001 From: Tinmarino Date: Sun, 9 Aug 2020 16:13:53 -0400 Subject: [PATCH] Test: Refactor: Normalize names and behavior --- .travis.yml | 11 +- ...tring.vader => config_commentstring.vader} | 0 test/{command_goto.vader => file_goto.vader} | 3 +- test/{filesystem.vader => file_system.vader} | 2 + ..._html.vader => html_convert_default.vader} | 1 + ...s_feed.vader => html_diary_rss_feed.vader} | 3 +- test/independent_runs/map.vader | 33 +++- test/independent_runs/search.vader | 2 +- test/issue_markdown.vader | 18 +- test/issue_profile_tabnext.vader | 51 ++++++ ...tiple_per_file.vader => link_anchor.vader} | 4 +- test/link_creation.vader | 8 + ...rate_links.vader => link_generation.vader} | 3 +- ..._rename_link.vader => link_renaming.vader} | 12 ++ test/{command_toc.vader => link_toc.vader} | 0 ..._VimwikiReturn.vader => list_return.vader} | 0 test/run_tests.sh | 159 +++++++++++------- test/tabnext_delay.vader | 30 ---- test/vimrc | 34 +++- 19 files changed, 261 insertions(+), 113 deletions(-) rename test/{commentstring.vader => config_commentstring.vader} (100%) rename test/{command_goto.vader => file_goto.vader} (95%) rename test/{filesystem.vader => file_system.vader} (92%) rename test/{convert_default_html.vader => html_convert_default.vader} (99%) rename test/{diary_rss_feed.vader => html_diary_rss_feed.vader} (96%) create mode 100644 test/issue_profile_tabnext.vader rename test/{link_markdown_multiple_per_file.vader => link_anchor.vader} (98%) rename test/{command_generate_links.vader => link_generation.vader} (98%) rename test/{command_rename_link.vader => link_renaming.vader} (94%) rename test/{command_toc.vader => link_toc.vader} (100%) rename test/{list_VimwikiReturn.vader => list_return.vader} (100%) delete mode 100644 test/tabnext_delay.vader diff --git a/.travis.yml b/.travis.yml index 3ad9aec..50b252e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,18 +24,19 @@ env: # Define jobs <- vim version <- hard copied from Dockerfile # First to be launched - VIM_VERSION=vint - - VIM_VERSION=vim_7.3.429 + - VIM_VERSION=vim_7.3.429 - 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 + # 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: # Run All tests - pushd test - 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"; fi - popd diff --git a/test/commentstring.vader b/test/config_commentstring.vader similarity index 100% rename from test/commentstring.vader rename to test/config_commentstring.vader diff --git a/test/command_goto.vader b/test/file_goto.vader similarity index 95% rename from test/command_goto.vader rename to test/file_goto.vader index 7e98884..e46f619 100644 --- a/test/command_goto.vader +++ b/test/file_goto.vader @@ -77,7 +77,8 @@ Execute (:VimwikiGoto + Completion in directory): AssertEqual 0, len(l_complete5) 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") # vim: sw=2 foldmethod=indent foldlevel=30 foldignore= diff --git a/test/filesystem.vader b/test/file_system.vader similarity index 92% rename from test/filesystem.vader rename to test/file_system.vader index 8bc4c5d..7c02071 100644 --- a/test/filesystem.vader +++ b/test/file_system.vader @@ -29,5 +29,7 @@ Do (At Index: Create and goto markdownfile): dd :call DeleteFile('mdfile.md')\ +Execute (Clean): + call DeleteFile("$HOME/testmarkdown/index.md") # vim: sw=2:foldmethod=marker:foldlevel=30:foldignore=: diff --git a/test/convert_default_html.vader b/test/html_convert_default.vader similarity index 99% rename from test/convert_default_html.vader rename to test/html_convert_default.vader index 4644df4..049c214 100644 --- a/test/convert_default_html.vader +++ b/test/html_convert_default.vader @@ -241,6 +241,7 @@ Execute (Edit TestHtml Wiki): Do (Markdwon with %plainhtml): :edit $HOME/testwiki/TestHtml.wiki\ + :normal ggdG\ i%plainhtml
\ my paragraph\ %plainhtml
\\ diff --git a/test/diary_rss_feed.vader b/test/html_diary_rss_feed.vader similarity index 96% rename from test/diary_rss_feed.vader rename to test/html_diary_rss_feed.vader index db6176d..f14e260 100644 --- a/test/diary_rss_feed.vader +++ b/test/html_diary_rss_feed.vader @@ -37,7 +37,8 @@ Do (Get RSS feed): :write Expect (RSS): - +# TODO the next line is deleted with -Es +# Diary diff --git a/test/independent_runs/map.vader b/test/independent_runs/map.vader index f7d4e24..0057c4d 100644 --- a/test/independent_runs/map.vader +++ b/test/independent_runs/map.vader @@ -1,3 +1,8 @@ +# Maps +# TODO make it without side effects +# -- Use the normal vimwiki or reset it + + # 0 Configure {{{1 ################## @@ -26,7 +31,23 @@ Execute (Configure: Set vimwiki list to markdown resource): let g:vimwiki_ext2syntax = {'.md': 'markdown'} 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): AssertEqual 2, len(vimwiki_wikilocal_vars) @@ -304,7 +325,15 @@ Given vimwiki (Completion list #813 {{{3): Do (Insert a list item and complete): Go - * comp\\\ + * comp\\\\ +# -Es -> Delete trailing * + :let mode = mode(1)\ + :Log 'Mode : ' .mode\ + :if mode ==# 'ce' || mode ==# 'cv'\ + try\ + g/^\* \?$/d\ + endtry\ + endif\ Expect (With a completion but no new item): complete1 diff --git a/test/independent_runs/search.vader b/test/independent_runs/search.vader index e70fc72..8ac679a 100644 --- a/test/independent_runs/search.vader +++ b/test/independent_runs/search.vader @@ -59,4 +59,4 @@ Execute (Search failure message): redir => output silent VimwikiSearch not_exist 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" diff --git a/test/issue_markdown.vader b/test/issue_markdown.vader index 36b8be4..375f81a 100644 --- a/test/issue_markdown.vader +++ b/test/issue_markdown.vader @@ -4,11 +4,18 @@ # 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): Log '#915 Vimwiki Markdown Blockquote Syntax issue' - file wiki_test.md call SetSyntax('markdown') Given vimwiki (One blockquote): @@ -46,7 +53,6 @@ Execute (no JJ && Assert for Version > 7.3): ################################################################################ Execute (Log): Log '#949 create link bug with Chinese characters' - file wiki_test.md call SetSyntax('markdown') Given vimwiki (Madarin with vimwiki Yeeepy): @@ -101,7 +107,6 @@ Expect (Renumber all): ################################################################################ Execute (Log): Log '#899 conceallevel is setted globally when editing a wiki file (PR #900)' - file wiki_test.md call SetSyntax('markdown') Given vimwiki (Void): @@ -163,3 +168,10 @@ Do (No link: ): :call vimwiki#vars#set_global('markdown_create_link', 0) \\ :AssertEqual expand('%:t'), 'main.md'\ + +Expect (Link): + [Link](Link) + +Execute (wipeout): + " This solves many things + file /testplugin/[Vader-workbench] diff --git a/test/issue_profile_tabnext.vader b/test/issue_profile_tabnext.vader new file mode 100644 index 0000000..46f3151 --- /dev/null +++ b/test/issue_profile_tabnext.vader @@ -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 diff --git a/test/link_markdown_multiple_per_file.vader b/test/link_anchor.vader similarity index 98% rename from test/link_markdown_multiple_per_file.vader rename to test/link_anchor.vader index 0af9047..2ff0784 100644 --- a/test/link_markdown_multiple_per_file.vader +++ b/test/link_anchor.vader @@ -72,6 +72,8 @@ Do (Enter link): A__HERE3__\ ggjjj\ A__HERE4__\ + :AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')\ + Expect vimwiki (Good anchor with link navigation): [A link B](#a-link-b) @@ -299,7 +301,7 @@ Expect (Just Contents/test1 got the second shot): - [filenew](filenew) first shot Execute (Delete filenew buffer): - bd! /testplugin/filenew.md + call DeleteFile('/testplugin/filenew.md') Do (Navigate with comeback with too far): \ diff --git a/test/link_creation.vader b/test/link_creation.vader index fd045c7..46e0f57 100644 --- a/test/link_creation.vader +++ b/test/link_creation.vader @@ -200,6 +200,11 @@ Do (Check in_tmp): jj\ :AssertEqual expand('%'), '/tmp/in_tmp.wiki'\ +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 #################### @@ -368,4 +373,7 @@ Expect (Mediawiki links): [[file.md]] [[file.mw]] +Execute(Clean: Icreated many temporary wiki): + call ReloadVimwiki() + # vim: foldmethod=marker foldlevel=30 diff --git a/test/command_generate_links.vader b/test/link_generation.vader similarity index 98% rename from test/command_generate_links.vader rename to test/link_generation.vader index 233f869..cec56d4 100644 --- a/test/command_generate_links.vader +++ b/test/link_generation.vader @@ -7,6 +7,7 @@ Execute (Copy Wiki's Resources): Log "Start: Copy Resources" call CopyResources() + set sw=8 # 1 VimwikiGenerateLinks {{{1 ########################## @@ -195,7 +196,7 @@ Expect (diary index generated): 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-07-13.md') call DeleteFile('$HOME/testmarkdown/diary/2019-03-01.md') diff --git a/test/command_rename_link.vader b/test/link_renaming.vader similarity index 94% rename from test/command_rename_link.vader rename to test/link_renaming.vader index df6a806..5686b59 100644 --- a/test/command_rename_link.vader +++ b/test/link_renaming.vader @@ -36,10 +36,21 @@ Execute (Create 3 files): Do (Testing Old buffer has been wiped out {{{2): :edit $HOME/testmarkdown/Test-Rename-Completion.md\ + :Log 'Get current Buffer'\ :let buf_old = bufnr('%')\ + :Log 'Is this wiki 2'\ + :AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')\ + :Log 'Delete for loosers'\ + :call DeleteFile('$HOME/testmarkdown/Test-Rename-new1.md')\ + :Log 'Rewrite ...'\ + :call WriteMe()\ + :Log 'Rename 1'\ :VimwikiRenameFile Test-Rename-new1\ + :Log 'Assert 1'\ :AssertEqual 'Test-Rename-new1', expand('%:t:r')\ + :Log 'Rename 2'\ :VimwikiRenameFile Test-Rename-Completion\ + :Log 'Assert 2'\ :AssertEqual expand('%'), $HOME . '/testmarkdown/Test-Rename-Completion.md'\ Do (Testing Completion {{{2): @@ -83,6 +94,7 @@ Do (Testing transforward {{{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/dir1/Test-Rename-Completion_2.md') call DeleteFile('$HOME/testmarkdown/dir1/Test-Rename-2.md') diff --git a/test/command_toc.vader b/test/link_toc.vader similarity index 100% rename from test/command_toc.vader rename to test/link_toc.vader diff --git a/test/list_VimwikiReturn.vader b/test/list_return.vader similarity index 100% rename from test/list_VimwikiReturn.vader rename to test/list_return.vader diff --git a/test/run_tests.sh b/test/run_tests.sh index ef79a16..61883ed 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -5,6 +5,7 @@ # Say Hi echo -en "Starting $(basename $0) for VimWiki\n" +start_time=`date +%s` # For windows: Cmder bash is appending busybox to the path and # 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". Default is all available versions. - -f (File) Comma seperated list of tests to run. - E.g. -o "list_margin,command_toc" + -f (File) Space separated list of tests to run. + E.g. -o "list_* z_success" -l (List) list available versions that can be used with the '-n' option @@ -38,7 +39,7 @@ printHelp() { -v (Verbose) Turn on verbose output. 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 bash run_tests.sh -v -t vader -n local -f z_success.vader | cat EOF @@ -59,12 +60,16 @@ runVader() { # Parse tests files to execute if [[ -z $file_test ]]; then - ind="test/independent_runs/*.vader" - res="test/*" + ind="test/independent_runs/*.vader" + res="test/*" else - IFS=',' read -ra TEST <<< "$file_test" + read -ra TEST <<< "$file_test" 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}" elif [[ -f "${i}.vader" ]]; then res="$res test/${i}.vader" @@ -77,11 +82,11 @@ runVader() { fi done fi - echo "Vader: will run files: $res and independently $ind" # Run tests for each specified version for v in $vers; do - echo -e "\nRunning version: $v" + echo -e "\n\nRunning version: $v" + echo -e "=============================" # Set local environment variables if [[ "$v" == "local" ]]; then @@ -98,15 +103,24 @@ runVader() { export ROOT="$tmp_dir/vader_wiki/" export HOME="$tmp_dir/vader_wiki/home" vim="vim" - vim_opt="-u ~/test/vimrc -i NONE" + vim_opt="-u ~/test/vimrc" else # Only set dockerized vars export ROOT="/" # So no if in vimrc vim="/vim-build/bin/$v" - vim_opt="-u test/vimrc -i NONE" + vim_opt="-u test/vimrc" 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 if [[ "$v" == "local" ]]; then @@ -124,41 +138,50 @@ runVader() { fi # Run batch of tests - if [[ "$v" == "local" ]]; then - pushd $tmp_dir/vader_wiki/testplugin + if [[ "$res" != "" ]]; then + if [[ "$v" == "local" ]]; then + pushd $tmp_dir/vader_wiki/testplugin - # Run the tests - echo -e "\nStarting vim with Vader" - "$vim" $vim_opt "+Vader! ${res}" 2>&1 - err=$(( $err | $? )) + # Run the tests + echo -e "\nStarting Batch Vim/Vader <- $res" + "$vim" $vim_opt "+Vader! ${res}" 2>&1 + ret=${PIPESTATUS[1]}; err=$(( $err + $ret )) + echo -e "\nReturned Batch Vim/Vader -> $ret" - popd - else # In docker - echo -e "\nStarting docker with vim with Vader" - docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \ - "$v" $vim_opt "+Vader! ${res}" 2>&1 | vader_filter | vader_color - err=$(( $err | $? )) + popd + else + # In docker + echo -e "\nStarting Independant Vim/Vader <- $res" + docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \ + "$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 # Run Tests that must be run in individual vim instances # see README.md for more information - test_cmd="for VF in ${ind}; do $vim $vim_opt \"+Vader! \$VF\"; done" - if [[ "$v" == "local" ]]; then - pushd $tmp_dir/vader_wiki/testplugin + if [[ "$ind" != "" ]]; then + test_cmd="for VF in ${ind}; do $vim $vim_opt \"+Vader! \$VF\"; done" + if [[ "$v" == "local" ]]; then + pushd $tmp_dir/vader_wiki/testplugin - echo "Starting vim with Vader" - bash -c "$test_cmd" 2>&1 - err=$(( $err | $? )) + echo -e "\nStarting Vim/Vader <- $test_cmd" + bash -c "$test_cmd" 2>&1 + ret=${PIPESTATUS[1]}; err=$(( $err + $ret )) + echo -e "\nReturned Vim/Vader -> $ret" - popd - else # In docker - echo "Starting docker with vim with Vader" - docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \ - /bin/bash -c "$test_cmd" 2>&1 | vader_filter | vader_color - err=$(( $err | $? )) + popd + else # In docker + echo -e "\nStarting Docker/Vim/Vader <- $test_cmd" + docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \ + /bin/bash -c "$test_cmd" 2>&1 | vader_filter | vader_color + ret=${PIPESTATUS[1]}; err=$(( $err + $ret )) + echo -e "\nReturned Docker/Vim/Vader -> $ret" + fi fi - set +o pipefail + #set +o pipefail # Restore what must (I know it should be refactored in a while) if [[ "$v" == "local" ]]; then @@ -186,43 +209,44 @@ runVint() { } getVers() { + # Get all possible version <- Dockerfile sed -n 's/.* -name \([^ ]*\) .*/\1/p' ../Dockerfile } vader_filter() { # Filter Vader Stdout local err=0 - while read -r; do + # Keep indentation + local IFS='' + while read -r REPLY; do # Print only possible error cases - if [[ "$verbose" == 0 ]]; then - if [[ "$REPLY" = *'docker:'* ]] || \ - [[ "$REPLY" = *'Starting Vader:'* ]] || \ - [[ "$REPLY" = *'Vader error:'* ]] || \ - [[ "$REPLY" = *'Vim: Error '* ]]; then - echo "$REPLY" - elif [[ "$REPLY" = *'[EXECUTE] (X)'* ]] || \ - [[ "$REPLY" = *'[ EXPECT] (X)'* ]]; then - echo "$REPLY" + if [[ "$REPLY" = *'docker:'* ]] || \ + [[ "$REPLY" = *'Starting Vader:'* ]] || \ + [[ "$REPLY" = *'Vader error:'* ]] || \ + [[ "$REPLY" = *'Vim: Error '* ]]; then + echo "$REPLY" + elif [[ "$REPLY" = *'[EXECUTE] (X)'* ]] || \ + [[ "$REPLY" = *'[ EXPECT] (X)'* ]]; then + 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 - 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 - else + echo "$REPLY" + elif [[ "$verbose" != 0 ]]; then # just print everything echo "$REPLY" fi done if [[ "$err" == 1 ]]; then - echo "" - echo "!---------Failed tests detected---------!" - echo "Run with the '-v' flag for verbose output" - echo "" + echo -e "\033[0;31m" + echo -e "!---------Failed tests detected---------!" + echo -e "Run with the '-v' flag for verbose output" + echo -e "\033[0m" fi return $err } @@ -329,24 +353,24 @@ trap exit 1 SIGINT SIGTERM # Global error return of the script o_error=0 -# select which tests should run +# Select which tests should run case $type in "vader" ) runVader ; err=$? - echo "Vader: returned $err" + echo "Main Vader: returned $err" o_error=$(( $err | $o_error )) ;; "vint" ) runVint ; err=$? - echo "Vint: returned $err" + echo "Main Vint: returned $err" o_error=$(( $err | $o_error )) ;; "all" ) runVint ; err=$? - echo "Vint: returned $err" + echo "Main Vint: returned $err" o_error=$(( $err | $o_error )) runVader ; err=$? - echo "Vader: returned $err" + echo "Main Vader: returned $err" o_error=$(( $err | $o_error )) ;; * ) @@ -354,6 +378,11 @@ case $type in exit 1 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 -echo "Script $(basename $0) exiting: $o_error" +echo -ne "Script $(basename $0), in $script_time, Returned -> $o_error\n\n" exit $o_error diff --git a/test/tabnext_delay.vader b/test/tabnext_delay.vader deleted file mode 100644 index 1092d42..0000000 --- a/test/tabnext_delay.vader +++ /dev/null @@ -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() diff --git a/test/vimrc b/test/vimrc index 534b0f9..595a9f0 100644 --- a/test/vimrc +++ b/test/vimrc @@ -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 " vint: -ProhibitSetNoCompatible set nocompatible filetype plugin indent on syntax enable +" Usefull var: for one day, making tests on local + let $TPLUGIN = '/testplugin' + let $THOME = $HOME " Set chrooted virtual runtime path let rtp=$ROOT.'/rtp.vim' @@ -43,9 +52,12 @@ " Register the 3 wikis let g:vimwiki_list = [vimwiki_default, vimwiki_markdown, vimwiki_mediawiki] + let g:vimwiki_list_vimrc = [vimwiki_default, vimwiki_markdown, vimwiki_mediawiki] " Set basic settings + " Avoid more prompt + set nomore set backspace=indent,eol,start set wildmode=longest:full,full set wildmenu @@ -119,8 +131,24 @@ " this is needed if running manually multiple times nmapclear - unlet g:loaded_vimwiki - source plugin/vimwiki.vim + " 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 + + " Reset list + let g:vimwiki_list = g:vimwiki_list_vimrc + + " Source plugin: Go + runtime! plugin/vimwiki.vim endfunction function! ReloadVars() @@ -165,7 +193,7 @@ catch | endtry " Delete Buffer try - execute 'bdelete! ' . path + execute 'bwipeout! ' . path catch | endtry endfunction