aboutsummaryrefslogtreecommitdiffstats
path: root/test/yarp
diff options
context:
space:
mode:
authorJemma Issroff <jemmaissroff@gmail.com>2023-09-22 12:05:47 -0400
committerGitHub <noreply@github.com>2023-09-22 12:05:47 -0400
commit9abaf392b1dd7d91392c2a35541ab1838b0b9e2f (patch)
treee1fed368c5ad2e2ba46435fb86652f197da94f69 /test/yarp
parentc54e225f34957967709dee59c0d66b265fd30e05 (diff)
downloadruby-9abaf392b1dd7d91392c2a35541ab1838b0b9e2f.tar.gz
Resync yarp (#8498)
* [YARP] Reject numbered parameters in block parameters * [YARP] Do not allow BEGIN except the toplevel --------- Co-authored-by: Haldun Bayhantopcu <haldun@github.com>
Diffstat (limited to 'test/yarp')
-rw-r--r--test/yarp/errors_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/yarp/errors_test.rb b/test/yarp/errors_test.rb
index d152c7cfc0..3f621b1c56 100644
--- a/test/yarp/errors_test.rb
+++ b/test/yarp/errors_test.rb
@@ -1302,6 +1302,20 @@ module YARP
assert_error_messages "%sXfooX", error_messages
end
+ def test_begin_at_toplevel
+ source = "def foo; BEGIN {}; end"
+ assert_errors expression(source), source, [
+ ["BEGIN is permitted only at toplevel", 9..14],
+ ]
+ end
+
+ def test_numbered_parameters_in_block_arguments
+ source = "foo { |_1| }"
+ assert_errors expression(source), source, [
+ ["Token reserved for a numbered parameter", 7..9],
+ ]
+ end
+
def test_conditional_predicate_closed
source = "if 0 0; end\nunless 0 0; end"
assert_errors expression(source), source, [