summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-12-06 08:48:29 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2026-02-04 13:28:34 +0900
commitcb303ff4b82dca932cb7342e9f7fd337d69dc175 (patch)
tree71897d1c0ddfbc78c0398f4358ceb0822ab03e86 /test
parentbaaf0ccb9c74d902d834c821c4d7e17e4bac4694 (diff)
[Bug #21669] Fix void value expression check for pattern-matching
If the all `in` and `else` branches are void, the `case` is also void.
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_syntax.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 1ea646d216..e868967e8b 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -2132,6 +2132,18 @@ eom
};
end
+ def test_value_expr_in_case3
+ assert_syntax_error("#{<<~"{#"}\n#{<<~'};'}", /void value expression/, nil, "#{BUG_21669} 1.3")
+ {#
+ x =
+ case a
+ in 1; return
+ in 2; return
+ else return
+ end
+ };
+ end
+
def test_tautological_condition
assert_valid_syntax("def f() return if false and invalid; nil end")
assert_valid_syntax("def f() return unless true or invalid; nil end")