Skip to content

Instantly share code, notes, and snippets.

@donnut
Created February 24, 2012 19:17
Show Gist options
  • Save donnut/1903082 to your computer and use it in GitHub Desktop.
Save donnut/1903082 to your computer and use it in GitHub Desktop.
Vim script to convert jasmine test file to qunit
"add this to .vimrc
source ~/dev/jasmine2qUnit/jasmine2qUnit.vim
nmap ;q :call ConvertJasmineTest2qUnit()<CR>
function! ConvertJasmine2qUnit()
%s/\vdescribe\((.*),\s*function\(\)\s*\{/module\(\1\);/ge
%s/\vit/test/ge
%s/\vexpect\((.+)\)\.toEqual\(?(.+)\)?/deepEqual\(\1, \2\)/ge
%s/\vexpect\((.+)\)\.toBeTruthy\(\)/ok \1/ge
%s/\vbeforeEach /setup: /ge
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment