sponsor Vim development Vim logo Vim Book Ad

stunter.vim : stunter.vim: run vim test

 script karma  Rating 0/0, Downloaded by 698  Comments, bugs, improvements  Vim wiki

created by
Anders Th√łgersen
script type
Stunter is for running test of vim scripts.

Here is a sample script:

    runtime stunter.vim

    " Need this to get the script id of the script being tested
    fun! s:SID()
      return matchstr(expand('<sfile>'), '<SNR>\\zs\\d\\+\\ze_SID$')

    " Get the Test(functionName, arguments, expectedReturnValue) function
    let Test = Stunter(s:SID())

    fun! s:TestMe1(a)
      return 30 + a:a

    fun! g:TestMe2(a)
      return 10 * a:a

    fun! TestMe3(a, b)
      return a:a + a:b

    call Test('s:TestMe1', [12], 42)
    call Test('g:TestMe2', [12], 120)
    call Test('TestMe3', [100, 8], 108)

If you `:source` a file with the above contents it should output:

    ok..1  s:TestMe1(12) == 42
    ok..2  g:TestMe2(12) == 120
    ok..3  TestMe3(100, 8) == 108

Please report bugs and issues here:

install details
unpack stunter.vim.zip from your ~/.vim directory or clone it from https://github.com/aklt/stunter.vim
using your favorite vim plugin manager.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
stunter.vim.zip 0.1.0 2017-06-25 8.0 Anders Th√łgersen Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
Vim at Github