Skip to content

Commit d1cff2f

Browse files
Add test for def node in module constant path
1 parent aac272e commit d1cff2f

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

test/prism/result/error_recovery_test.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ def test_interpolated_string_node_parts_interpolated_xstring
9292
assert node.parts.any? { |part| part.is_a?(ErrorRecoveryNode) && part.child.is_a?(InterpolatedXStringNode) }
9393
end
9494

95+
def test_module_node_constant_path_def
96+
result = Prism.parse("module def foo; end")
97+
refute result.success?
98+
99+
node = result.value.statements.body.first
100+
assert_kind_of ErrorRecoveryNode, node.constant_path
101+
assert_kind_of DefNode, node.constant_path.child
102+
end
103+
95104
def test_module_node_constant_path_missing
96105
result = Prism.parse("module Parent module end")
97106
refute result.success?

0 commit comments

Comments
 (0)