1
0
Fork 0
mirror of synced 2024-11-12 20:28:58 -05:00
ultimate-vim/sources_non_forked/vim-ruby/spec/indent/blocks_spec.rb
Maksim Pecherskiy 2deb035254 Cleaning deps.
2014-08-07 19:42:41 -04:00

69 lines
1.2 KiB
Ruby

require 'spec_helper'
describe "Indenting" do
specify "'do' indenting" do
assert_correct_indenting <<-EOF
do
something
end
EOF
assert_correct_indenting <<-EOF
def foo
a_hash = {:do => 'bar'}
end
EOF
assert_correct_indenting <<-EOF
def foo(job)
job.do!
end
EOF
end
specify "blocks with multiline parameters" do
assert_correct_indenting <<-EOF
def foo
opts.on('--coordinator host=HOST[,port=PORT]',
'Specify the HOST and the PORT of the coordinator') do |str|
h = sub_opts_to_hash(str)
puts h
end
end
EOF
end
specify "case-insensitive matching" do
@vim.set 'ignorecase'
assert_correct_indenting <<-EOF
module X
Class.new do
end
end
EOF
@vim.set 'ignorecase&'
end
specify "blocks with tuple arguments" do
assert_correct_indenting <<-EOF
proc do |(a, b)|
puts a
puts b
end
EOF
assert_correct_indenting <<-EOF
proc do |foo, (a, b), bar|
puts a
puts b
end
EOF
assert_correct_indenting <<-EOF
proc do |(a, (b, c)), d|
puts a, b
puts c, d
end
EOF
end
end