Skip to content

Commit e98a0bb

Browse files
author
Iuri Fernandes
committed
Add more tricky failing specs. Thanks to @meh.
1 parent e9d03bb commit e98a0bb

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

spec/indent/anonymous_functions_spec.rb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
require 'spec_helper'
22

33
describe "Indenting" do
4-
context "one liner functions inside do block declaring" do
5-
it "with fn syntax" do
4+
context "single body functions inside do block" do
5+
it "is declared with fn syntax" do
66
assert_correct_indenting <<-EOF
77
def do
88
some_func = fn x -> x end
99
end
1010
EOF
1111
end
1212

13-
it "with function syntax" do
13+
it "is declared with function syntax" do
1414
assert_correct_indenting <<-EOF
1515
def do
1616
some_func = function do x -> x end
@@ -19,6 +19,16 @@ def do
1919
end
2020

2121
it "spans in multiple lines" do
22+
assert_correct_indenting <<-EOF
23+
def test do
24+
assert_raise Queue.Empty, fn ->
25+
Q.new |> Q.deq!
26+
end
27+
end
28+
EOF
29+
end
30+
31+
it "spans in multiple lines inside parentheses" do
2232
assert_correct_indenting <<-EOF
2333
defmodule Test do
2434
def lol do

spec/indent/documentation_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
require 'spec_helper'
2+
3+
describe "Indenting" do
4+
context "documentation" do
5+
it "with end keyword" do
6+
assert_correct_indenting <<-EOF
7+
defmodule Test do
8+
@doc ""
9+
end
10+
""
11+
end
12+
EOF
13+
end
14+
end
15+
end

0 commit comments

Comments
 (0)