Permalink
Browse files

Add test framework and travis ci build

  • Loading branch information...
1 parent 723ca92 commit 9f2d841859a167a50e9fe752543ae581012aff19 @MattesGroeger committed Mar 22, 2014
Showing with 114 additions and 1 deletion.
  1. +2 −0 .gitignore
  2. +3 −0 .travis.yml
  3. +2 −0 Gemfile
  4. +42 −0 Gemfile.lock
  5. +8 −0 Guardfile
  6. +11 −0 Rakefile
  7. +1 −1 Readme.md
  8. +12 −0 autoload/model.vim
  9. +33 −0 t/model_spec.vim
View
@@ -1 +1,3 @@
*/tags
+VimFlavor.lock
+.vim-flavor
View
@@ -0,0 +1,3 @@
+language: ruby
+rvm: 2.0.0
+script: rake ci
View
@@ -3,3 +3,5 @@ source 'https://rubygems.org'
gem 'rake'
gem 'octokit'
gem 'netrc'
+gem 'guard-shell'
+gem 'vim-flavor'
View
@@ -2,21 +2,63 @@ GEM
remote: https://rubygems.org/
specs:
addressable (2.3.5)
+ blankslate (2.1.2.4)
+ celluloid (0.15.2)
+ timers (~> 1.1.0)
+ celluloid-io (0.15.0)
+ celluloid (>= 0.15.0)
+ nio4r (>= 0.5.0)
+ coderay (1.1.0)
faraday (0.9.0)
multipart-post (>= 1.2, < 3)
+ ffi (1.9.3)
+ formatador (0.2.4)
+ guard (2.5.1)
+ formatador (>= 0.2.4)
+ listen (~> 2.6)
+ lumberjack (~> 1.0)
+ pry (>= 0.9.12)
+ thor (>= 0.18.1)
+ guard-shell (0.6.1)
+ guard (>= 1.1.0)
+ listen (2.7.1)
+ celluloid (>= 0.15.2)
+ celluloid-io (>= 0.15.0)
+ rb-fsevent (>= 0.9.3)
+ rb-inotify (>= 0.9)
+ lumberjack (1.0.5)
+ method_source (0.8.2)
multipart-post (2.0.0)
netrc (0.7.7)
+ nio4r (1.0.0)
octokit (2.7.2)
sawyer (~> 0.5.2)
+ parslet (1.5.0)
+ blankslate (~> 2.0)
+ pry (0.9.12.6)
+ coderay (~> 1.0)
+ method_source (~> 0.8)
+ slop (~> 3.4)
rake (0.9.2.2)
+ rb-fsevent (0.9.4)
+ rb-inotify (0.9.3)
+ ffi (>= 0.5.0)
sawyer (0.5.3)
addressable (~> 2.3.5)
faraday (~> 0.8, < 0.10)
+ slop (3.5.0)
+ thor (0.19.0)
+ timers (1.1.0)
+ vim-flavor (2.0.0)
+ parslet (~> 1.0)
+ thor (~> 0.14)
PLATFORMS
ruby
DEPENDENCIES
+ guard-shell
netrc
octokit
rake
+ vim-flavor
View
@@ -0,0 +1,8 @@
+guard :shell do
+ watch(/(autoload|plugin|t)\/.+\.vim$/) do |m|
+ cmd = "rake test"
+ puts "Executing #{cmd}"
+ puts `#{cmd}`
+ puts '...done.'
+ end
+end
View
@@ -6,6 +6,17 @@ VIM_SCRIPT_URL = "http://www.vim.org/scripts/add_script_version.php?script_id=48
EXCLUDE_LABELS = ["duplicate", "invalid", "question", "task", "wontfix"]
task :default => [:release]
+task :ci => [:dump, :test]
+
+desc "Dump version numbers"
+task :dump do
+ sh 'vim --version'
+end
+
+desc "Run tests"
+task :test do
+ sh "bundle exec vim-flavor test"
+end
desc "Create release archive"
task :release do
View
@@ -1,4 +1,4 @@
-## vim-bookmarks
+## vim-bookmarks [![Build Status](https://travis-ci.org/MattesGroeger/vim-bookmarks.svg)](https://travis-ci.org/MattesGroeger/vim-bookmarks)
This plugin allows to add and remove line-based bookmarks with just one (!) keystroke. Bookmarks will be highlighted in the vim sign column (default).
View
@@ -48,6 +48,10 @@ function! model#del_bookmark_at_line(file, line_nr)
let l:bookmark = model#get_bookmark_by_line(a:file, a:line_nr)
unlet g:line_map[a:file][a:line_nr]
unlet g:sign_map[a:file][l:bookmark['sign_idx']]
+ if empty(g:line_map[a:file])
+ unlet g:line_map[a:file]
+ unlet g:sign_map[a:file]
+ endif
endfunction
function! model#all_bookmarks_by_line(file)
@@ -68,4 +72,12 @@ function! model#all_files()
return keys(g:line_map)
endfunction
+function! model#del_all()
+ for l:file in keys(g:line_map)
+ for l:line_nr in keys(g:line_map[l:file])
+ call model#del_bookmark_at_line(l:file, l:line_nr)
+ endfor
+ endfor
+endfunction
+
" }}}
View
@@ -0,0 +1,33 @@
+describe 'model#del_all'
+
+ it 'should reset the model'
+ call model#add_bookmark('file1', 1, 1, 'line1')
+ call model#add_bookmark('file2', 2, 1, 'line1')
+
+ call model#del_all()
+
+ Expect empty(g:line_map) to_be_true
+ Expect empty(g:sign_map) to_be_true
+ Expect model#has_bookmarks_in_file('file1') to_be_false
+ Expect model#has_bookmarks_in_file('file2') to_be_false
+ end
+
+end
+
+describe 'model#has_bookmarks_in_file'
+
+ after
+ call model#del_all()
+ end
+
+ it 'should have no bookmarks'
+ Expect model#has_bookmarks_in_file('foo') to_be_false
+ end
+
+ it 'should have bookmark'
+ call model#add_bookmark('foo', 1, 3, 'bar')
+ Expect model#has_bookmarks_in_file('foo') to_be_true
+ call model#del_bookmark_at_line('foo', 3)
+ end
+
+end

0 comments on commit 9f2d841

Please sign in to comment.