Skip to content
Emux Evans edited this page Sep 4, 2013 · 49 revisions

Green Bar
A short video.

Why do I write a CppUTest plugin

When you use this plugin, you can:

  • Setup a TDD project for C or C++ quickly;
  • Write the testing code and run it more efficiently;
  • Get the Green or Red bar after testing.

TDD is a wonderful development method
It helps me designing the right things.
I really appreciate Michael Feathers and other contributors make this awesome CppUTest TDD suit.
Although it provides many useful scripts to create a TDD project quickly,
I would like to write a plugin for CppUTest to make me do TDD more happy.

How to install it

You should install CppUTest and autotools(autoconf/automake ...) before using this plugin.

$ #On ubuntu
$ sudo apt-get install cpputest autotools-dev

I also installed clang_complete plugin using clang for accurately completing C and C++ code.
I strongly recommend that you install this plugin to write C/C++ code more efficiently.

If you are a new VIMer:
Copy the .vim directory and .vimrc file to your HOME and all things ready.

If you have already configured your own VIM:

  • Copy .vim/plugins/CppUTest.vim and .vim/plugins/CppUTest.sh to your plugin directory.
  • Copy ~/.vim/c-support/templates/c.comments.template to your template directory.
  • Append following text to your .vimrc file:
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CppUTest.vim Setting
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nmap <leader>un :call CppUTest_UnittestNew()<CR>
imap <leader>un <Esc>:call CppUTest_UnittestNew()<CR>
nmap <leader>ua :call CppUTest_UnittestAdd()<CR>
imap <leader>ua <Esc>:call CppUTest_UnittestAdd()<CR>
nmap <leader>uap :call CppUTest_UnittestAddCpp()<CR>
imap <leader>uap <Esc>:call CppUTest_UnittestAddCpp()<CR>
nmap <leader>ur :call CppUTest_UnittestRun()<CR>
imap <leader>ur <Esc>:call CppUTest_UnittestRun()<CR>
nmap <leader>up :call CppUTest_UnittestPerform()<CR>
imap <leader>up <Esc>:call CppUTest_UnittestPerform()<CR>

How to use it

Setup environment

$ export TERM=xterm
$ cd ~/.vim
$ ./setupvim.sh "Your Name" [email protected] www.your-website.com "Your Company Name"

**Use shortcuts in your VIM**
Assume that your own **mapleader** for VIM is **,**.
* **,un** -- Unit testing New, create a new TDD project; * **,ua** -- Unit testing Add, add a new unit testing for C; * **,uap** -- Unit testing Add, add a new unit testing fro C++; * **,ur** -- Unit testing Run, save all files in the buffer and run the unit testing.

If your use my .vim and .vimrc, you can use following shortcuts:

  • sj -- Open buffer quickly from existing buffers, supported by fuzzfinder plugin;
  • sk -- Open files quickly from working directory, supported by fuzzfinder plugin;
  • <c-k> -- Accurately completing C and C++ code, supported by clang_complete and supperTab plugin;
  • <TAB> -- Type arguments for function call quickly when completing by clang_complete , supported by code_complete plugin;
  • Please access my .vimrc file for more information about shortcuts.

If you want to use clang_complete to develop linux driver for ARM or MIPS:

  • For ARM -- Copy ~/.vim/clang_complete/arm_driver/.clang_complete to /path/to/your/driver/source/dir;
  • For MIPS -- Copy ~/.vim/clang_complete/mips_driver/.clang_complete to /path/to/your/driver/source/dir.

Acknowledge

I appreciate authors and contributors of the following VIM plugins:

  • 02tlib.vim
  • DoxygenToolkit.vim
  • autoclose.vim
  • bufexplorer.vim
  • c.vim
  • clang_complete.vim
  • cmdline-complete.vim
  • code_complete.vim
  • emmet.vim
  • fuf.vim
  • grep.vim
  • l9.vim
  • supertab.vim
  • taglist.vim
  • totd.vim
  • molokai.vim (Color Scheme)
  • ...
Clone this wiki locally