Skip to content

Commit 6b165bd

Browse files
authored
Backport(v1.16): test_fluentd: fix assert pattern of syntax error for Ruby HEAD (#4644) (#5187)
Backport #4644 **Which issue(s) this PR fixes**: Fixes # Related to #4584 **What this PR does / why we need it**: Ruby parser will be replaced new parser in Ruby 3.4. ruby/ruby@ea2af57 The new parser might not have a fully compatible of Syntax error messages. So I modified the assert pattern to succeed in the Ruby HEAD. ### example ```ruby module Foo class Bar def say puts "hello" end end ``` ### result with Ruby 3.3.5 ``` $ ruby -v test.rb ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [x86_64-linux] test.rb: --> test.rb Unmatched keyword, missing `end' ? > 1 module Foo test.rb:6: syntax error, unexpected end-of-input, expecting `end' or dummy end (SyntaxError) end ^ ``` ### result with Ruby 3.4-dev ```ruby ruby -v test.rb ruby 3.4.0dev (2024-09-25T02:45:33Z master 76543a34ab) +PRISM [x86_64-linux] test.rb: --> test.rb Unmatched keyword, missing `end' ? > 1 module Foo test.rb:7: syntax errors found (SyntaxError) 5 | end 6 | end > 7 | | ^ expected an `end` to close the `module` statement | ^ unexpected end-of-input, assuming it is closing the parent top level context ``` Ruby 3.3.5 has `test.rb:6: syntax error,..`, but Ruby 3.4-dev has `test.rb:7: syntax errors...`. **Docs Changes**: **Release Note**: Signed-off-by: Shizuo Fujita <[email protected]>
1 parent 8140ef8 commit 6b165bd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/command/test_fluentd.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ def assert_fluentd_fails_to_start(cmdline, *pattern_list, timeout: 20)
570570

571571
assert_fluentd_fails_to_start(
572572
create_cmdline(conf_path, "-p", File.dirname(plugin_path)),
573-
"in_buggy.rb:5: syntax error, unexpected end-of-input"
573+
/in_buggy.rb:\d+:.+\(SyntaxError\)/
574574
)
575575
end
576576
end

0 commit comments

Comments
 (0)