Sha256: cdd49819aedbe279767b6d1ad7044f4f74f33de50817351e8d8c89202d44fc9c

Contents?: true

Size: 1.62 KB

Versions: 216

Compression:

Stored size: 1.62 KB

Contents

## SETUP

This track uses two tools to run the test suite and ensure best practices:

1. [vader.vim](https://github.com/junegunn/vader.vim)
2. [vint](https://github.com/Kuniwak/vint)

#### Running tests

1. Install [vader.vim](https://github.com/junegunn/vader.vim/#installation).
1. Open your solution:
    ```
    $ vim exercise.vim
    ```
1. Source the current file to make its global functions available to Vim:
    ```
    :source %
    ```
1. Run the tests:
    ```
    :Vader exercise.vader
    ```

Paths may vary.

If you want a convenient shortcut to the above steps, put this in your vimrc:

```vim
function! s:exercism_tests()
  if expand('%:e') == 'vim'
    let testfile = printf('%s/%s.vader', expand('%:p:h'),
          \ tr(expand('%:p:h:t'), '-', '_'))
    if !filereadable(testfile)
      echoerr 'File does not exist: '. testfile
      return
    endif
    source %
    execute 'Vader' testfile
  else
    let sourcefile = printf('%s/%s.vim', expand('%:p:h'),
          \ tr(expand('%:p:h:t'), '-', '_'))
    if !filereadable(sourcefile)
      echoerr 'File does not exist: '. sourcefile
      return
    endif
    execute 'source' sourcefile
    Vader
  endif
endfunction

autocmd BufRead *.{vader,vim}
      \ command! -buffer Test call s:exercism_tests()
```

Afterwards open any `.vim` or `.vader` file from an exercise directory and run
the `:Test` command.

#### Linting Vim files

1. Install [vint](https://github.com/Kuniwak/vint#quick-start).
1. Recursively lint all Vim files:
    ```
    $ vint .
    ```

For more detailed information about the Vim script track, please see the
[help page](http://exercism.io/languages/vimscript).

Version data entries

216 entries across 216 versions & 1 rubygems

Version Path
trackler-2.1.0.41 tracks/vimscript/docs/TESTS.md
trackler-2.1.0.40 tracks/vimscript/docs/TESTS.md
trackler-2.1.0.39 tracks/vimscript/docs/TESTS.md
trackler-2.1.0.38 tracks/vimscript/docs/TESTS.md
trackler-2.1.0.37 tracks/vimscript/docs/TESTS.md
trackler-2.1.0.36 tracks/vimscript/docs/TESTS.md
trackler-2.1.0.34 tracks/vimscript/docs/TESTS.md
trackler-2.1.0.33 tracks/vimscript/docs/TESTS.md
trackler-2.1.0.32 tracks/vimscript/docs/TESTS.md
trackler-2.1.0.31 tracks/vimscript/docs/TESTS.md
trackler-2.1.0.30 tracks/vimscript/docs/TESTS.md
trackler-2.1.0.29 tracks/vimscript/docs/TESTS.md
trackler-2.1.0.28 tracks/vimscript/docs/TESTS.md
trackler-2.1.0.27 tracks/vimscript/docs/TESTS.md
trackler-2.1.0.26 tracks/vimscript/docs/TESTS.md
trackler-2.1.0.25 tracks/vimscript/docs/TESTS.md