Skip to content

Commit 848c0a3

Browse files
committed
Add tests for Block#location
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
1 parent 45b77a4 commit 848c0a3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/rbs/parser_test.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,20 @@ def test_parse_method_type2
733733
end
734734
end
735735

736+
def test_parse_method_type_block
737+
RBS::Parser.parse_method_type(buffer("{ -> void } -> void")).tap do |method_type|
738+
assert_equal "{ -> void }", method_type.block.location.source
739+
end
740+
741+
RBS::Parser.parse_method_type(buffer("(Integer) { (Integer) -> void } -> void")).tap do |method_type|
742+
assert_equal "{ (Integer) -> void }", method_type.block.location.source
743+
end
744+
745+
RBS::Parser.parse_method_type(buffer("() ?{ () -> void } -> void")).tap do |method_type|
746+
assert_equal "?{ () -> void }", method_type.block.location.source
747+
end
748+
end
749+
736750
def test_newline_inconsistency
737751
code = "module Test\r\nend"
738752

0 commit comments

Comments
 (0)