From cb686b9cccf571a70f4ac85bef0ebb2b544fba97 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Fri, 15 Sep 2023 11:09:18 -0400 Subject: [ruby/yarp] Handle missing clauses in case statement https://github.com/ruby/yarp/commit/1ad7fba5ef --- test/yarp/errors_test.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/yarp/errors_test.rb b/test/yarp/errors_test.rb index 57a2cab011..9664c47148 100644 --- a/test/yarp/errors_test.rb +++ b/test/yarp/errors_test.rb @@ -949,7 +949,21 @@ module YARP ) assert_errors expected, "case :a\nelse\nend", [ - ["Unexpected `else` in `case` statement; a `when` clause must precede `else`", 8..12] + ["Expected a `when` or `in` clause after `case`", 0..4] + ] + end + + def test_case_without_clauses + expected = CaseNode( + SymbolNode(Location(), Location(), nil, "a"), + [], + nil, + Location(), + Location() + ) + + assert_errors expected, "case :a\nend", [ + ["Expected a `when` or `in` clause after `case`", 0..4] ] end -- cgit v1.2.3