Created
February 24, 2012 19:17
-
-
Save donnut/1903082 to your computer and use it in GitHub Desktop.
Vim script to convert jasmine test file to qunit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"add this to .vimrc | |
source ~/dev/jasmine2qUnit/jasmine2qUnit.vim | |
nmap ;q :call ConvertJasmineTest2qUnit()<CR> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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