diff options
| author | Earlopain <14981592+Earlopain@users.noreply.github.com> | 2026-05-13 13:52:14 +0200 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu.nakada@gmail.com> | 2026-05-15 19:58:27 +0900 |
| commit | 11de89ca1a94899535875ea594962c79713615b1 (patch) | |
| tree | 4e4168068173f85498f1c7541af29568be656ab1 /test | |
| parent | 4d87d43b01dbb312eb1ff5fbbc6c9f33218d91a2 (diff) | |
Reject `END { next } ` as well
Followup for https://bugs.ruby-lang.org/issues/20409
Diffstat (limited to 'test')
| -rw-r--r-- | test/prism/errors/4.1/end_block_exit.txt | 5 | ||||
| -rw-r--r-- | test/prism/fixtures/3.3-4.0/end_block_exit.txt | 4 | ||||
| -rw-r--r-- | test/prism/fixtures/end_block_exit.txt | 3 | ||||
| -rw-r--r-- | test/ruby/test_ast.rb | 7 |
4 files changed, 11 insertions, 8 deletions
diff --git a/test/prism/errors/4.1/end_block_exit.txt b/test/prism/errors/4.1/end_block_exit.txt index f8fc59d1a3..a4a1e9bc2c 100644 --- a/test/prism/errors/4.1/end_block_exit.txt +++ b/test/prism/errors/4.1/end_block_exit.txt @@ -3,3 +3,8 @@ END { ^~~~~ Invalid break } +END { + next + ^~~~ Invalid next +} + diff --git a/test/prism/fixtures/3.3-4.0/end_block_exit.txt b/test/prism/fixtures/3.3-4.0/end_block_exit.txt index 53afa1e2f4..8ebf0d6369 100644 --- a/test/prism/fixtures/3.3-4.0/end_block_exit.txt +++ b/test/prism/fixtures/3.3-4.0/end_block_exit.txt @@ -5,3 +5,7 @@ END { END { break } + +END { + next +} diff --git a/test/prism/fixtures/end_block_exit.txt b/test/prism/fixtures/end_block_exit.txt deleted file mode 100644 index 1f64dcb6ed..0000000000 --- a/test/prism/fixtures/end_block_exit.txt +++ /dev/null @@ -1,3 +0,0 @@ -END { - next -} diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb index a59ce277d1..8b9a3f615d 100644 --- a/test/ruby/test_ast.rb +++ b/test/ruby/test_ast.rb @@ -255,11 +255,8 @@ class TestAst < Test::Unit::TestCase assert_invalid_parse(msg, "#{code}") assert_invalid_parse(msg, "def m; #{code}; end") assert_invalid_parse(msg, "begin; #{code}; end") - if code.start_with?("next") - assert_parse("END {#{code}}") - else - assert_invalid_parse(msg, "END {#{code}}") - end + assert_invalid_parse(msg, "BEGIN {#{code}}") + assert_invalid_parse(msg, "END {#{code}}") assert_parse("!defined?(#{code})") assert_parse("def m; defined?(#{code}); end") |
