mirror of
1
0
Fork 0
ultimate-vim/sources_non_forked/vim-ruby/spec/indent/method_definitions_spec.rb

77 lines
1.3 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

require 'spec_helper'
describe "Indenting" do
specify "method definitions prefixed with access modifiers" do
assert_correct_indenting <<~EOF
class Foo
public def one(x)
end
private def two(y)
code
end
end
EOF
end
specify "method definitions prefixed with any method call" do
assert_correct_indenting <<~EOF
class Foo
foobar def one(x)
end
foobar? def one(x)
end
foobar! def one(x)
end
фубар def one(x)
end
foobar
def one(x)
end
FooBar1 def two(y)
code
end
end
EOF
end
specify "endless methods" do
# Note: A case that doesn't work at this time:
#
# def foo()
# = 42
#
assert_correct_indenting <<~EOF
indented_block do
def foo(bar) = puts(bar)
def foo!(bar) = puts(bar)
def foo?(bar) = puts(bar)
def foo(bar)=puts(bar)
def foo(bar) = bar + 1
def foo() = 1 + 1
def foo = 1 + 1
private def foo(bar) = bar + 1
def foo(bar) =
bar + 1
def foo(bar = default_function()) = puts(bar)
def foo(bar = default_function()) =
puts(bar)
def foo(
bar
) = puts(bar)
end
EOF
end
end