Skip to content

Commit

Permalink
Add one test for indent/ooc.vim and .travis.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
nddrylliog committed Dec 1, 2013
1 parent ec3897b commit 14e7099
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: ruby
rvm:
- 1.9.3
before_install: sudo apt-get install vim-gtk
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source 'https://rubygems.org'

gem 'vimrunner', '~> 0.3.0'
gem 'rspec', '~> 2.14.1'
gem 'rake', '~> 10.1.0'
22 changes: 22 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.2.5)
rake (10.1.0)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.7)
rspec-expectations (2.14.4)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.4)
vimrunner (0.3.0)

PLATFORMS
ruby

DEPENDENCIES
rake (~> 10.1.0)
rspec (~> 2.14.1)
vimrunner (~> 0.3.0)
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
28 changes: 28 additions & 0 deletions spec/indent_ooc_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

require 'spec_helper'

describe 'indent/ooc.vim' do
describe 'Basic block behavior' do
specify 'blocks such as classes, funcs, should be indented correctly' do
write_file('test.ooc', <<-EOF)
Dog: class {
init: func {
a: Int
}
}
EOF

vim.edit 'test.ooc'
do_indent(vim)

IO.read('test.ooc').rstrip.should eq normalize_string_indent(<<-EOF)
Dog: class {
init: func {
a: Int
}
}
EOF
end
end
end

25 changes: 25 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require 'vimrunner'
require 'vimrunner/rspec'

Vimrunner::RSpec.configure do |config|
# Use a single Vim instance for the test suite
config.reuse_server = true

config.start_vim do
vim = Vimrunner.start_gvim

# Load ooc indentation
plugin_path = File.expand_path('../..', __FILE__)
vim.add_plugin(plugin_path, 'indent/ooc.vim')

vim
end
end

# indent
def do_indent(vim)
vim.set('ft', 'ooc')
vim.normal "ggvG=" # go to beginning, indent all
vim.write
end

0 comments on commit 14e7099

Please sign in to comment.