mirror of
https://github.com/amix/vimrc
synced 2025-07-03 22:25:32 +08:00
Cleaning deps.
This commit is contained in:
24
sources_non_forked/vim-ruby/spec/indent/arguments_spec.rb
Normal file
24
sources_non_forked/vim-ruby/spec/indent/arguments_spec.rb
Normal file
@ -0,0 +1,24 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Indenting" do
|
||||
specify "multi-line arguments" do
|
||||
assert_correct_indenting <<-EOF
|
||||
User.new(
|
||||
:first_name => 'Some',
|
||||
:second_name => 'Guy'
|
||||
)
|
||||
EOF
|
||||
|
||||
assert_correct_indenting <<-EOF
|
||||
User.new(:first_name => 'Some',
|
||||
:second_name => 'Guy')
|
||||
EOF
|
||||
|
||||
assert_correct_indenting <<-EOF
|
||||
User.new(
|
||||
:first_name => 'Some',
|
||||
:second_name => 'Guy'
|
||||
)
|
||||
EOF
|
||||
end
|
||||
end
|
42
sources_non_forked/vim-ruby/spec/indent/basic_spec.rb
Normal file
42
sources_non_forked/vim-ruby/spec/indent/basic_spec.rb
Normal file
@ -0,0 +1,42 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Indenting" do
|
||||
specify "if-clauses" do
|
||||
assert_correct_indenting <<-EOF
|
||||
if foo
|
||||
bar
|
||||
end
|
||||
EOF
|
||||
|
||||
assert_correct_indenting <<-EOF
|
||||
if foo
|
||||
bar
|
||||
else
|
||||
baz
|
||||
end
|
||||
EOF
|
||||
|
||||
assert_correct_indenting <<-EOF
|
||||
bar if foo
|
||||
something_else
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "heredocs" do
|
||||
assert_correct_indenting <<-EOF
|
||||
def one
|
||||
two = <<-THREE
|
||||
four
|
||||
THREE
|
||||
end
|
||||
EOF
|
||||
|
||||
assert_correct_indenting <<-EOF
|
||||
def one
|
||||
two = <<THREE
|
||||
four
|
||||
THREE
|
||||
end
|
||||
EOF
|
||||
end
|
||||
end
|
69
sources_non_forked/vim-ruby/spec/indent/blocks_spec.rb
Normal file
69
sources_non_forked/vim-ruby/spec/indent/blocks_spec.rb
Normal file
@ -0,0 +1,69 @@
|
||||
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
|
142
sources_non_forked/vim-ruby/spec/indent/continuations_spec.rb
Normal file
142
sources_non_forked/vim-ruby/spec/indent/continuations_spec.rb
Normal file
@ -0,0 +1,142 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Indenting" do
|
||||
specify "arrays" do
|
||||
assert_correct_indenting <<-EOF
|
||||
foo = [one,
|
||||
two,
|
||||
three]
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "tricky string interpolation" do
|
||||
# See https://github.com/vim-ruby/vim-ruby/issues/75 for details
|
||||
assert_correct_indenting <<-EOF
|
||||
puts %{\#{}}
|
||||
puts "OK"
|
||||
EOF
|
||||
|
||||
assert_correct_indenting <<-EOF
|
||||
while true
|
||||
begin
|
||||
puts %{\#{x}}
|
||||
rescue ArgumentError
|
||||
end
|
||||
end
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "continuations after round braces" do
|
||||
assert_correct_indenting <<-EOF
|
||||
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
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "continuations after assignment" do
|
||||
assert_correct_indenting <<-EOF
|
||||
variable =
|
||||
if condition?
|
||||
1
|
||||
else
|
||||
2
|
||||
end
|
||||
EOF
|
||||
|
||||
assert_correct_indenting <<-EOF
|
||||
variable = # evil comment
|
||||
case something
|
||||
when 'something'
|
||||
something_else
|
||||
else
|
||||
other
|
||||
end
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "continuations after hanging comma" do
|
||||
assert_correct_indenting <<-EOF
|
||||
array = [
|
||||
:one,
|
||||
].each do |x|
|
||||
puts x.to_s
|
||||
end
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "string interpolation" do
|
||||
# See https://github.com/vim-ruby/vim-ruby/issues/93 for details
|
||||
assert_correct_indenting <<-EOF
|
||||
command = %|\#{file}|
|
||||
settings.log.info("Returning: \#{command}")
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "closing bracket not on its own line" do
|
||||
# See https://github.com/vim-ruby/vim-ruby/issues/81 for details
|
||||
assert_correct_indenting <<-EOF
|
||||
one { two >>
|
||||
three }
|
||||
four
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "lonesome single parenthesis in a method definition" do
|
||||
# See https://github.com/vim-ruby/vim-ruby/issues/130 for details
|
||||
assert_correct_indenting <<-EOF
|
||||
def bar(
|
||||
baz
|
||||
)
|
||||
return baz+1
|
||||
end
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "brackets on their own line, followed by a comma" do
|
||||
# See https://github.com/vim-ruby/vim-ruby/issues/124 for details
|
||||
assert_correct_indenting <<-EOF
|
||||
bla = {
|
||||
:one => [
|
||||
{:bla => :blub}
|
||||
],
|
||||
:two => (
|
||||
{:blub => :abc}
|
||||
),
|
||||
:three => {
|
||||
:blub => :abc
|
||||
},
|
||||
:four => 'five'
|
||||
}
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "string with an and#" do
|
||||
# See https://github.com/vim-ruby/vim-ruby/issues/108 for details
|
||||
assert_correct_indenting <<-EOF
|
||||
outside_block "and#" do
|
||||
inside_block do
|
||||
end
|
||||
end
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "continuation with a symbol at the end" do
|
||||
# See https://github.com/vim-ruby/vim-ruby/issues/132 for details
|
||||
assert_correct_indenting <<-EOF
|
||||
foo = :+
|
||||
# Next indents correctly
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "continuation with a hanging comma" do
|
||||
# See https://github.com/vim-ruby/vim-ruby/issues/139 for details
|
||||
assert_correct_indenting <<-EOF
|
||||
thing :foo
|
||||
thing 'a',
|
||||
'b'
|
||||
EOF
|
||||
end
|
||||
end
|
@ -0,0 +1,31 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Indenting" do
|
||||
specify "end constructs" do
|
||||
assert_correct_indenting <<-EOF
|
||||
f do
|
||||
g { def h; end }
|
||||
end
|
||||
EOF
|
||||
|
||||
assert_correct_indenting <<-EOF
|
||||
if foo
|
||||
bar ; end
|
||||
something_else
|
||||
EOF
|
||||
|
||||
assert_correct_indenting <<-EOF
|
||||
if bar ; end
|
||||
something_else
|
||||
EOF
|
||||
|
||||
assert_correct_indenting <<-EOF
|
||||
foo do
|
||||
foo = 3 . class
|
||||
foo = lambda { class One; end }
|
||||
foo = lambda { |args| class One; end }
|
||||
foo = bar; class One; end
|
||||
end
|
||||
EOF
|
||||
end
|
||||
end
|
66
sources_non_forked/vim-ruby/spec/indent/nesting_spec.rb
Normal file
66
sources_non_forked/vim-ruby/spec/indent/nesting_spec.rb
Normal file
@ -0,0 +1,66 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Indenting" do
|
||||
specify "nested blocks" do
|
||||
assert_correct_indenting <<-EOF
|
||||
var.func1(:param => 'value') do
|
||||
var.func2(:param => 'value') do
|
||||
puts "test"
|
||||
end
|
||||
end
|
||||
EOF
|
||||
|
||||
assert_correct_indenting <<-EOF
|
||||
var.func1(:param => 'value') {
|
||||
var.func2(:param => 'value') {
|
||||
foo({ bar => baz })
|
||||
puts "test one"
|
||||
puts "test two"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
assert_correct_indenting <<-EOF
|
||||
var.
|
||||
func1(:param => 'value') {
|
||||
var.func2(:param => 'value') {
|
||||
puts "test"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "nested hashes" do
|
||||
assert_correct_indenting <<-EOF
|
||||
foo, bar = {
|
||||
:bar => {
|
||||
:one => 'two',
|
||||
:five => 'six'
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
assert_correct_indenting <<-EOF
|
||||
foo,
|
||||
bar = {
|
||||
:bar => {
|
||||
:foo => { 'bar' => 'baz' },
|
||||
:one => 'two',
|
||||
:three => 'four'
|
||||
}
|
||||
}
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "nested blocks with a continuation and function call inbetween" do
|
||||
assert_correct_indenting <<-EOF
|
||||
var.
|
||||
func1(:param => 'value') {
|
||||
func1_5(:param => 'value')
|
||||
var.func2(:param => 'value') {
|
||||
puts "test"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
end
|
||||
end
|
46
sources_non_forked/vim-ruby/spec/indent/splat_spec.rb
Normal file
46
sources_non_forked/vim-ruby/spec/indent/splat_spec.rb
Normal file
@ -0,0 +1,46 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Indenting" do
|
||||
specify "splats with blocks in square brackets" do
|
||||
assert_correct_indenting <<-EOF
|
||||
x = Foo[*
|
||||
y do
|
||||
z
|
||||
end
|
||||
]
|
||||
EOF
|
||||
|
||||
assert_correct_indenting <<-EOF
|
||||
x = Foo[* # with a comment
|
||||
y do
|
||||
z
|
||||
end
|
||||
]
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "splats with blocks in assignment" do
|
||||
assert_correct_indenting <<-EOF
|
||||
x = *
|
||||
array.map do
|
||||
3
|
||||
end
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "splats with blocks in round brackets" do
|
||||
assert_correct_indenting <<-EOF
|
||||
x = Foo(*y do
|
||||
z
|
||||
end)
|
||||
EOF
|
||||
|
||||
assert_correct_indenting <<-EOF
|
||||
x = Foo(
|
||||
*y do
|
||||
z
|
||||
end
|
||||
)
|
||||
EOF
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user