sponsor Vim development Vim logo go to HTTPS page Vim Book Ad

stunter.vim : stunter.vim: run vim test

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

created by
Anders Thøgersen
 
script type
utility
 
description
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$')
    endfun

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

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

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

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

    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:

    https://github.com/aklt/stunter.vim/issues
 
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: 54.224.41.46

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.
   
SourceForge.net Logo