Commits

ZyX_I committed c37f41c

Added tests

  • Participants
  • Parent commits 5f45eaa

Comments (0)

Files changed (51)

File test/double-registration.in

+:let &rtp.=",".escape($TESTDIR, ',\').'/rtp'
+:let g:testfile="plugin/double-registration.vim"
+:source test.vim
+:source test.vim

File test/double-registration.ok

+Frawor:plugin/frawor:doublereg

File test/gentests-strange-filenames.zsh

+#!/bin/zsh
+emulate -LR zsh
+typeset -a chars
+set -A chars $' ' $'\n'
+typeset -A charnames
+charnames[${chars[1]}]=space
+charnames[${chars[2]}]=newline
+nl=$'\n'
+for char in $chars ; do
+    rtp="${PWD:A}/rtp$char"
+    mkdir -p "$rtp/plugin"
+    cp rtp/plugin/register-return-value.vim "$rtp/plugin"
+    echo > register-return-value-with-${charnames[$char]}.in "\
+:let g:testfile='plugin/register-return-value.vim'
+:let &rtp.=','.${${${(qqq)rtp}}//$nl/\\\\n}
+:source test.vim"
+    cp rtp/plugin/register-return-value.vim \
+        "$rtp/plugin/register-return-value$char.vim"
+    echo > register-return-value-with-${charnames[$char]}-in-scriptname.in "\
+:let g:testfile=\"plugin/register-return-value${char//$nl/\\\\n}.vim\"
+:let &rtp.=','.${${(qqq)rtp}//$nl/\\\\n}
+:source test.vim"
+done
+

File test/invalid-FraworRegister-arguments.in

+:let &rtp.=",".escape($TESTDIR, ',\').'/rtp'
+:let g:testfile="plugin/invalid-FraworRegister-arguments.1.vim"
+:source test.vim
+:let g:testfile="plugin/invalid-FraworRegister-arguments.2.vim"
+:source test.vim
+:let g:testfile="plugin/invalid-FraworRegister-arguments.3.vim"
+:source test.vim
+:let g:testfile="plugin/invalid-FraworRegister-arguments.4.vim"
+:source test.vim
+:let g:testfile="plugin/invalid-FraworRegister-arguments.5.vim"
+:source test.vim
+:let g:testfile="plugin/invalid-FraworRegister-arguments.6.vim"
+:source test.vim
+:let g:testfile="plugin/invalid-FraworRegister-arguments.7.vim"
+:source test.vim

File test/invalid-FraworRegister-arguments.ok

+Frawor:plugin/frawor:gnotdict
+Frawor:plugin/frawor:Fnotdict
+Frawor:plugin/frawor:sidnotnum
+Frawor:plugin/frawor:sidnonpos
+Frawor:plugin/frawor:filenotstr
+Frawor:plugin/frawor:fileempty
+Frawor:plugin/frawor:depnotdict

File test/missing-dependencies.in

+:let &rtp.=",".escape($TESTDIR, ',\').'/rtp'
+:let g:testfile="plugin/missing-dependencies.vim"
+:source test.vim

File test/missing-dependencies.ok

+Frawor:plugin/frawor:reqfailed

File test/plugin-with-dependencies.in

+:let &rtp.=",".escape($TESTDIR, ',\').'/rtp'
+:let g:testfile="plugin/plugin-with-dependencies.vim"
+:source test.vim

File test/plugin-with-dependencies.ok

+id: 'plugin/register-return-value'
+runtimepath: '/home/zyx/a.a/.settings/home/.vim/dev/repository/tmp/test/rtp'
+type: 'plugin'
+id: 'plugin/plugin-with-dependencies'
+runtimepath: '/home/zyx/a.a/.settings/home/.vim/dev/repository/tmp/test/rtp'
+type: 'plugin'

File test/plugin-with-feature.in

+:let &rtp.=",".escape($TESTDIR, ',\').'/rtp'
+:let g:testfile="plugin/plugin-depends-on-plugin-with-feature.vim"
+:source test.vim

File test/plugin-with-feature.ok

+load: plugin/plugin-depends-on-plugin-with-feature
+Frawor:plugin/plugin-with-feature:testmsg:This is a test message: test
+cons: plugin/plugin-depends-on-plugin-with-feature

File test/recursive-dependent.in

+:let &rtp.=",".escape($TESTDIR, ',\').'/rtp'
+:let g:testfile="plugin/recursive-dependent.vim"
+:source test.vim

File test/recursive-dependent.ok

+id: 'plugin/register-return-value'
+runtimepath: '/home/zyx/a.a/.settings/home/.vim/dev/repository/tmp/test/rtp'
+type: 'plugin'
+id: 'plugin/plugin-with-dependencies'
+runtimepath: '/home/zyx/a.a/.settings/home/.vim/dev/repository/tmp/test/rtp'
+type: 'plugin'
+id: 'plugin/recursive-dependent.2'
+runtimepath: '/home/zyx/a.a/.settings/home/.vim/dev/repository/tmp/test/rtp'
+type: 'plugin'
+id: 'plugin/recursive-dependent'
+runtimepath: '/home/zyx/a.a/.settings/home/.vim/dev/repository/tmp/test/rtp'
+type: 'plugin'

File test/register-feature-list.in

+:let &rtp.=",".escape($TESTDIR, ',\').'/rtp'
+:let g:testfile="plugin/register-feature-list.vim"
+:source test.vim

File test/register-feature-list.ok

+newfeature
+throw
+warn

File test/register-return-value-not-in-rtp.in

+:let g:testfile="rtp/plugin/register-return-value.vim"
+:let g:testcmd="source"
+:source test.vim

File test/register-return-value-not-in-rtp.ok

+id: '/home/zyx/a.a/.settings/home/.vim/dev/repository/tmp/test/rtp/plugin/register-return-value'
+runtimepath: ''
+type: '/unknown'

File test/register-return-value-with-newline-in-scriptname.ok

Binary file added.

File test/register-return-value-with-newline.ok

Binary file added.

File test/register-return-value-with-space-in-scriptname.ok

+id: 'plugin/register-return-value '
+runtimepath: '/home/zyx/a.a/.settings/home/.vim/dev/repository/tmp/test/rtp '
+type: 'plugin'

File test/register-return-value-with-space.ok

+id: 'plugin/register-return-value'
+runtimepath: '/home/zyx/a.a/.settings/home/.vim/dev/repository/tmp/test/rtp '
+type: 'plugin'

File test/register-return-value.in

+:let &rtp.=",".escape($TESTDIR, ',\').'/rtp'
+:let g:testfile="plugin/register-return-value.vim"
+:source test.vim

File test/register-return-value.ok

+id: 'plugin/register-return-value'
+runtimepath: '/home/zyx/a.a/.settings/home/.vim/dev/repository/tmp/test/rtp'
+type: 'plugin'

File test/rtp/plugin/double-registration.vim

+execute frawor#Setup('0.0', {}, 0)
+delfunction s:Eval

File test/rtp/plugin/invalid-FraworRegister-arguments.1.vim

+call FraworRegister([0, 0], 3, expand('<sfile>'), {}, 0, [], {})
+

File test/rtp/plugin/invalid-FraworRegister-arguments.2.vim

+call FraworRegister([0, 0], 3, expand('<sfile>'), {}, 0, {}, [])
+

File test/rtp/plugin/invalid-FraworRegister-arguments.3.vim

+call FraworRegister([0, 0], "3", expand('<sfile>'), {}, 0, {}, {})
+

File test/rtp/plugin/invalid-FraworRegister-arguments.4.vim

+call FraworRegister([0, 0], 0, expand('<sfile>'), {}, 0, {}, {})
+

File test/rtp/plugin/invalid-FraworRegister-arguments.5.vim

+call FraworRegister([0, 0], 3, 0, {}, 0, {}, {})
+

File test/rtp/plugin/invalid-FraworRegister-arguments.6.vim

+call FraworRegister([0, 0], 3, '', {}, 0, {}, {})
+

File test/rtp/plugin/invalid-FraworRegister-arguments.7.vim

+call FraworRegister([0, 0], 3, expand('<sfile>'), [], 0, {}, {})
+

File test/rtp/plugin/major-version-mismatch.vim

+execute frawor#Setup('0.0', {'plugin/register-feature-list': '1'}, 1)
+

File test/rtp/plugin/minor-version-mismatch.vim

+execute frawor#Setup('0.0', {'plugin/register-feature-list': '0.1'}, 1)
+

File test/rtp/plugin/missing-dependencies.vim

+execute frawor#Setup('1.1', {'plugin/xxx-missing-plugin': [0]}, 1)
+

File test/rtp/plugin/plugin-depends-on-plugin-with-feature.vim

+execute frawor#Setup('0.0', {'plugin/plugin-with-feature': '0'}, 1)
+call s:F._frawor.testfeature()
+

File test/rtp/plugin/plugin-with-dependencies.vim

+execute frawor#Setup('1.1', {'plugin/register-return-value': [0]}, 1)
+let s:r=[]
+if filereadable(g:outfile)
+    let s:r+=readfile(g:outfile, 'b')
+endif
+for s:key in sort(keys(s:g._frawor))
+    call add(s:r, s:key.': '.string(s:g._frawor[s:key]))
+endfor
+call writefile(s:r, g:outfile, 'b')
+

File test/rtp/plugin/plugin-with-feature.vim

+execute frawor#Setup('0.0', {}, 1)
+let s:g._messages={'testmsg': 'This is a test message: %s'}
+function s:F.testfeaturecons(plugdict)
+    try
+        call s:F._frawor.throw('testmsg', 'test')
+    catch /^Frawor:plugin\%x2Fplugin-with-feature:testmsg:This is a test message: test$/
+        let r=[]
+        if filereadable(g:outfile)
+            let r+=readfile(g:outfile, 'b')
+        endif
+        call add(r, v:exception)
+        call add(r, 'cons: '.a:plugdict.id)
+        call writefile(r, g:outfile, 'b')
+    endtry
+endfunction
+function s:F.testfeatureload(plugdict)
+    let r=[]
+    if filereadable(g:outfile)
+        let r+=readfile(g:outfile, 'b')
+    endif
+    call add(r, 'load: '.a:plugdict.id)
+    call writefile(r, g:outfile, 'b')
+endfunction
+call s:F._frawor.newfeature('testfeature', {'cons': s:F.testfeaturecons,
+            \                               'load': s:F.testfeatureload})
+

File test/rtp/plugin/recursive-dependent.2.vim

+execute frawor#Setup('1.1', {'plugin/recursive-dependent': [1]}, 1)
+let s:r=[]
+if filereadable(g:outfile)
+    let s:r+=readfile(g:outfile, 'b')
+endif
+for s:key in sort(keys(s:g._frawor))
+    call add(s:r, s:key.': '.string(s:g._frawor[s:key]))
+endfor
+call writefile(s:r, g:outfile, 'b')
+

File test/rtp/plugin/recursive-dependent.vim

+execute frawor#Setup('1.1', {'plugin/recursive-dependent.2':    [1, 1],
+            \                'plugin/plugin-with-dependencies': [1, 1]}, 1)
+let s:r=[]
+if filereadable(g:outfile)
+    let s:r+=readfile(g:outfile, 'b')
+endif
+for s:key in sort(keys(s:g._frawor))
+    call add(s:r, s:key.': '.string(s:g._frawor[s:key]))
+endfor
+call writefile(s:r, g:outfile, 'b')
+

File test/rtp/plugin/register-feature-list.vim

+execute frawor#Setup('0.0', {}, 1)
+let s:r=[]
+if filereadable(g:outfile)
+    let s:r+=readfile(g:outfile, 'b')
+endif
+let s:r+=sort(keys(s:F._frawor))
+call writefile(s:r, g:outfile, 'b')
+

File test/rtp/plugin/register-return-value.vim

+execute frawor#Setup('0.0', {}, 1)
+let s:r=[]
+if filereadable(g:outfile)
+    let s:r+=readfile(g:outfile, 'b')
+endif
+for s:key in sort(keys(s:g._frawor))
+    call add(s:r, s:key.': '.string(s:g._frawor[s:key]))
+endfor
+call writefile(s:r, g:outfile, 'b')
+

File test/rtp/plugin/version-errors.1.vim

+execute frawor#Setup({}, {}, 1)

File test/rtp/plugin/version-errors.2.vim

+execute frawor#Setup([0], {}, 1)
+

File test/rtp/plugin/version-errors.3.vim

+execute frawor#Setup([0, 0, "abc"], {}, 1)
+

File test/test.vim

+let g:outfile=g:curtest.'.out'
+if !exists('g:testcmd')
+    let g:testcmd='runtime!'
+endif
+try
+    execute g:testcmd fnameescape(g:testfile)
+catch
+    let r=[substitute(v:exception,
+                \'Frawor:\%(\\.\|[^:]\)\+:\%(\\.\|[^:]\)\+\zs:.*', '', '')]
+    if filereadable(g:outfile)
+        call extend(r, readfile(g:outfile, 'b'), 0)
+    endif
+    call writefile(r, g:outfile, 'b')
+endtry
+

File test/valid-double-registration.in

+:let &rtp.=",".escape($TESTDIR, ',\').'/rtp'
+:let &rtp.=",".escape($TESTDIR, ',\').'/rtp '
+:let &rtp.=",".escape($TESTDIR, ',\')."/rtp\n"
+:let g:testfile="plugin/register-return-value.vim"
+:source test.vim

File test/valid-double-registration.ok

Binary file added.

File test/version-errors.in

+:let &rtp.=",".escape($TESTDIR, ',\').'/rtp'
+:let g:testfile="plugin/version-errors.1.vim"
+:source test.vim
+:let g:testfile="plugin/version-errors.2.vim"
+:source test.vim
+:let g:testfile="plugin/version-errors.3.vim"
+:source test.vim

File test/version-errors.ok

+Frawor:plugin/frawor:vernotlist
+Frawor:plugin/frawor:vershort
+Frawor:plugin/frawor:vernotnum

File test/version-mismatch.in

+:let &rtp.=",".escape($TESTDIR, ',\').'/rtp'
+:let g:testfile="plugin/major-version-mismatch.vim"
+:source test.vim
+:let g:testfile="plugin/minor-version-mismatch.vim"
+:source test.vim

File test/version-mismatch.ok

+newfeature
+throw
+warn
+Frawor:plugin/frawor:majmismatch
+Frawor:plugin/frawor:oldversion