Slide 1

Slide 1 text

Testing Vimscript with Vimrunner

Slide 2

Slide 2 text

PAUL MUCUR @mudge

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Why would I want to test Vimscript?

Slide 5

Slide 5 text

CAESAR.VIM

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

$  vim  -­‐-­‐version VIM  -­‐  Vi  IMproved  7.3  (2010  Aug  15,  compiled  Feb  16  2013  12:20:10) MacOS  X  (unix)  version Included  patches:  1-­‐754 Compiled  by  [email protected] Huge  version  with  MacVim  GUI.    Features  included  (+)  or  not  (-­‐): +arabic  +autocmd  +balloon_eval  +browse  ++builtin_terms  +byte_offset  +cindent   +clientserver  +clipboard  +cmdline_compl  +cmdline_hist  +cmdline_info  +comments   +conceal  +cryptv  -­‐cscope  +cursorbind  +cursorshape  +dialog_con_gui  +diff   +digraphs  +dnd  -­‐ebcdic  +emacs_tags  +eval  +ex_extra  +extra_search  +farsi   +file_in_path  +find_in_path  +float  +folding  -­‐footer  +fork()  +fullscreen   -­‐gettext  -­‐hangul_input  +iconv  +insert_expand  +jumplist  +keymap  +langmap   +libcall  +linebreak  +lispindent  +listcmds  +localmap  -­‐lua  +menu  +mksession   +modify_fname  +mouse  +mouseshape  +mouse_dec  -­‐mouse_gpm  -­‐mouse_jsbterm   +mouse_netterm  +mouse_sgr  -­‐mouse_sysmouse  +mouse_urxvt  +mouse_xterm  +multi_byte  +multi_lang  -­‐mzscheme  +netbeans_intg  +odbeditor  +path_extra  +perl   +persistent_undo  +postscript  +printer  +profile  +python  -­‐python3  +quickfix   +reltime  +rightleft  +ruby  +scrollbind  +signs  +smartindent  -­‐sniff  +startuptime   +statusline  -­‐sun_workshop  +syntax  +tag_binary  +tag_old_static  -­‐tag_any_white   +tcl  +terminfo  +termresponse  +textobjects  +title  +toolbar  +transparency   +user_commands  +vertsplit  +virtualedit  +visual  +visualextra  +viminfo  +vreplace   +wildignore  +wildmenu  +windows  +writebackup  -­‐X11  -­‐xfontset  +xim  -­‐xsmp   -­‐xterm_clipboard  -­‐xterm_save  

Slide 9

Slide 9 text

$  vim  -­‐-­‐version VIM  -­‐  Vi  IMproved  7.3  (2010  Aug  15,  compiled  Feb  16  2013  12:20:10) MacOS  X  (unix)  version Included  patches:  1-­‐754 Compiled  by  [email protected] Huge  version  with  MacVim  GUI.    Features  included  (+)  or  not  (-­‐): +arabic  +autocmd  +balloon_eval  +browse  ++builtin_terms  +byte_offset  +cindent   +clientserver  +clipboard  +cmdline_compl  +cmdline_hist  +cmdline_info  +comments   +conceal  +cryptv  -­‐cscope  +cursorbind  +cursorshape  +dialog_con_gui  +diff   +digraphs  +dnd  -­‐ebcdic  +emacs_tags  +eval  +ex_extra  +extra_search  +farsi   +file_in_path  +find_in_path  +float  +folding  -­‐footer  +fork()  +fullscreen   -­‐gettext  -­‐hangul_input  +iconv  +insert_expand  +jumplist  +keymap  +langmap   +libcall  +linebreak  +lispindent  +listcmds  +localmap  -­‐lua  +menu  +mksession   +modify_fname  +mouse  +mouseshape  +mouse_dec  -­‐mouse_gpm  -­‐mouse_jsbterm   +mouse_netterm  +mouse_sgr  -­‐mouse_sysmouse  +mouse_urxvt  +mouse_xterm  +multi_byte  +multi_lang  -­‐mzscheme  +netbeans_intg  +odbeditor  +path_extra  +perl   +persistent_undo  +postscript  +printer  +profile  +python  -­‐python3  +quickfix   +reltime  +rightleft  +ruby  +scrollbind  +signs  +smartindent  -­‐sniff  +startuptime   +statusline  -­‐sun_workshop  +syntax  +tag_binary  +tag_old_static  -­‐tag_any_white   +tcl  +terminfo  +termresponse  +textobjects  +title  +toolbar  +transparency   +user_commands  +vertsplit  +virtualedit  +visual  +visualextra  +viminfo  +vreplace   +wildignore  +wildmenu  +windows  +writebackup  -­‐X11  -­‐xfontset  +xim  -­‐xsmp   -­‐xterm_clipboard  -­‐xterm_save  

Slide 10

Slide 10 text

Demonstration of Vim’s client-server functionality

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

vim  =  Vimrunner.start vim.edit("foo.txt") vim.insert("Hello  world!") vim.write

Slide 13

Slide 13 text

Demonstration of using Vimrunner to remote control Vim from Ruby

Slide 14

Slide 14 text

describe  "caesar.vim"  do    it  "converts  1  to  I"  do        expect(vim.echo("caesar#ToRoman(1)")).to  eq("I")    end end

Slide 15

Slide 15 text

Demonstration of test- driving Vim script with Vimrunner

Slide 16

Slide 16 text

language:  ruby rvm:    -­‐  1.9.3 before_install:  sudo  apt-­‐get  install  vim-­‐gtk before_script:    -­‐  "export  DISPLAY=:99.0"    -­‐  "sh  -­‐e  /etc/init.d/xvfb  start" TRAVIS CI

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

VIM-UNITTEST? VIM-QUICKCHECK? VIM-Your-Test-Library-of-Choice?

Slide 19

Slide 19 text

Thank you @mudge http://mudge.name