Skip to content

Commit

Permalink
add test for restore position patch
Browse files Browse the repository at this point in the history
  • Loading branch information
maksimr committed Dec 30, 2012
1 parent 61bcbe3 commit 9e6931a
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 2 deletions.
4 changes: 2 additions & 2 deletions grunt.js
Expand Up @@ -25,7 +25,7 @@ module.exports = function(grunt) {
},
watch: {
vim: {
files: ['plugin/*.vim', 'test/**/*.sh'],
files: ['plugin/*.vim', 'test/vim/**/*'],
tasks: 'urchin'
},
javascript: {
Expand Down Expand Up @@ -53,7 +53,7 @@ module.exports = function(grunt) {
}
}
});
grunt.registerTask('urchin', 'Urchin is a test framework for shell. It currently supports bash on GNU/Linux and Mac.', function(options) {
grunt.registerTask('urchin', 'Urchin is a test framework for shell. It currently supports bash on GNU/Linux and Mac.', function() {
var data = grunt.config('urchin');
var utils = grunt.utils;
var verbose = grunt.verbose;
Expand Down
@@ -0,0 +1,24 @@
#!/bin/bash

# test_07
# It should format javascript file
# when we open it in new buffer
# with default settings

TMP_FILE='_tmp'

echo $(cat file) > $TMP_FILE

vim -u vimrc -c "execute 'bnext' | call setpos('.', [0,1,23,0]) | execute 'silent call JsBeautify()' | call setline('1', getpos('.')) | w | q | q" cap $TMP_FILE

RESULT=$(cat $TMP_FILE)

#clean
if [ -f $TMP_FILE ]
then
rm $TMP_FILE
fi

clear

[ "$RESULT" = "$(cat expected)" ]
4 changes: 4 additions & 0 deletions test/vim/test_08/expected
@@ -0,0 +1,4 @@
0
2
15
0
1 change: 1 addition & 0 deletions test/vim/test_08/file
@@ -0,0 +1 @@
(function(){return "1";}());
12 changes: 12 additions & 0 deletions test/vim/test_08/vimrc
@@ -0,0 +1,12 @@
" vim -u vimrc
set nocompatible

set nowrap

let root = '~/.vim/bundle'

filetype off
syntax on

runtime macros/matchit.vim
exec 'set rtp+='.root.'/vim-jsbeautify'

0 comments on commit 9e6931a

Please sign in to comment.