From 685efac05983dee44ce2d96c24f2fcb96a0aebe2 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 29 Jun 2022 14:13:15 +0900 Subject: [Bug #18884] `class` cannot be just followed by modifiers --- test/ruby/test_parse.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/ruby/test_parse.rb') diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index 2841e20f6d..1d756441f8 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -1359,6 +1359,13 @@ x = __ENCODING__ end; end + def test_if_after_class + assert_valid_syntax('module if true; Object end::Kernel; end') + assert_valid_syntax('module while true; break Object end::Kernel; end') + assert_valid_syntax('class if true; Object end::Kernel; end') + assert_valid_syntax('class while true; break Object end::Kernel; end') + end + =begin def test_past_scope_variable assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}} -- cgit v1.2.3