roryokane / detectindent

Vim script for automatically detecting indent settings
21 stars 6 forks source link

Add unit tests for options (g:detectindent_*) #12

Open roryokane opened 9 years ago

roryokane commented 9 years ago

These tests could go in a file like tests/config-options-are-respected.vader. Here is a start at writing it:

Execute (reset indent options to initial values):
  " so it is clear what values later tests are working with
  setglobal noexpandtab tabstop=8 softtabstop=0 shiftwidth=8

Execute (TODO g:detectindent_preferred_indent is respected):
  let g:detectindent_preferred_indent = 4
  " TODO open a file, DetectIndent, and check that the settings are different
  " from what they would be if that option wasn’t set
  unlet g:detectindent_preferred_indent

# TODO test the other options too

Unit tests for options would confirm that options currently behave desirably in all situations, and ensure that they keep functioning properly when the code is changed.