summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2023-09-15 11:09:18 -0400
committergit <svn-admin@ruby-lang.org>2023-09-15 23:32:05 +0000
commitcb686b9cccf571a70f4ac85bef0ebb2b544fba97 (patch)
treecd7f6eaa679f1d08c1411bd0801691e7123d6019 /test
parent4c28a61e835645fefa238536acd6334451fb2dde (diff)
[ruby/yarp] Handle missing clauses in case statement
https://github.com/ruby/yarp/commit/1ad7fba5ef
Diffstat (limited to 'test')
-rw-r--r--test/yarp/errors_test.rb16
1 files changed, 15 insertions, 1 deletions
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