diff options
| author | Kevin Newton <kddnewton@gmail.com> | 2023-09-15 11:09:18 -0400 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2023-09-15 23:32:05 +0000 |
| commit | cb686b9cccf571a70f4ac85bef0ebb2b544fba97 (patch) | |
| tree | cd7f6eaa679f1d08c1411bd0801691e7123d6019 /test | |
| parent | 4c28a61e835645fefa238536acd6334451fb2dde (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.rb | 16 |
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 |
