summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2024-04-02 15:24:28 -0400
committerKevin Newton <kddnewton@gmail.com>2024-04-03 17:34:12 -0400
commit198d197aeb79566673db2440a3b90ff87ff279cd (patch)
tree093a33e9baae4083635b9b895d0a4f6ad1ff3d17 /test
parent7ddf093588c3af1be27a24c232a626fa70f07cca (diff)
[ruby/prism] Allow block exits in defined? and fix modifier while/until
https://github.com/ruby/prism/commit/2752f0b8df
Diffstat (limited to 'test')
-rw-r--r--test/prism/errors_test.rb15
-rw-r--r--test/prism/parse_test.rb2
2 files changed, 7 insertions, 10 deletions
diff --git a/test/prism/errors_test.rb b/test/prism/errors_test.rb
index adcf2d03b1..1d9bc0f986 100644
--- a/test/prism/errors_test.rb
+++ b/test/prism/errors_test.rb
@@ -257,7 +257,7 @@ module Prism
["unexpected ',', expecting end-of-input", 6..7],
["unexpected ',', ignoring it", 6..7],
["expected a matching `)`", 6..6],
- ["Invalid next", 0..4],
+ ["Invalid next", 0..12],
["unexpected ')', expecting end-of-input", 12..13],
["unexpected ')', ignoring it", 12..13]
]
@@ -266,7 +266,7 @@ module Prism
def test_next_1
assert_errors expression("next 1,;"), "next 1,;", [
["expected an argument", 6..7],
- ["Invalid next", 0..4]
+ ["Invalid next", 0..7]
]
end
@@ -275,7 +275,7 @@ module Prism
["unexpected ',', expecting end-of-input", 7..8],
["unexpected ',', ignoring it", 7..8],
["expected a matching `)`", 7..7],
- ["Invalid break", 0..5],
+ ["Invalid break", 0..13],
["unexpected ')', expecting end-of-input", 13..14],
["unexpected ')', ignoring it", 13..14]
]
@@ -284,7 +284,7 @@ module Prism
def test_break_1
assert_errors expression("break 1,;"), "break 1,;", [
["expected an argument", 7..8],
- ["Invalid break", 0..5]
+ ["Invalid break", 0..8]
]
end
@@ -1095,7 +1095,7 @@ module Prism
)
assert_errors expected, "class A; return; end", [
- ["invalid `return` in a class or module body", 9..15]
+ ["Invalid return in class/module body", 9..15]
]
end
@@ -1110,7 +1110,7 @@ module Prism
)
assert_errors expected, "module A; return; end", [
- ["invalid `return` in a class or module body", 10..16]
+ ["Invalid return in class/module body", 10..16]
]
end
@@ -1577,11 +1577,8 @@ module Prism
message = "unexpected void value expression"
assert_errors expression(source), source, [
[message, 7..13],
- ["Invalid break", 35..40],
[message, 35..40],
- ["Invalid next", 51..55],
[message, 51..55],
- ["Invalid redo", 66..70],
[message, 66..70],
["Invalid retry without rescue", 81..86],
[message, 81..86],
diff --git a/test/prism/parse_test.rb b/test/prism/parse_test.rb
index d171a3aa76..afb53e0668 100644
--- a/test/prism/parse_test.rb
+++ b/test/prism/parse_test.rb
@@ -189,7 +189,7 @@ module Prism
FileUtils.mkdir_p(directory) unless File.directory?(directory)
ripper_should_match = ripper_enabled
- check_valid_syntax = true
+ check_valid_syntax = RUBY_VERSION >= "3.2.0"
case relative
when "seattlerb/pct_w_heredoc_interp_nested.txt"