diff options
author | Étienne Barrié <[email protected]> | 2025-03-24 12:17:58 +0100 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2025-03-27 17:54:56 +0100 |
commit | 6ecfe643b5d8d64682c6f6bce5b27db5c007331d (patch) | |
tree | 3e509be8f58cf5a3fcbc4485db33e9e2b032b5a8 /spec/ruby/command_line | |
parent | 49d49d5985fa22d6f283e1f0e5299d18dd94e77d (diff) |
Freeze $/ and make it ractor safe
[Feature #21109]
By always freezing when setting the global rb_rs variable, we can ensure
it is not modified and can be accessed from a ractor.
We're also making sure it's an instance of String and does not have any
instance variables.
Of course, if $/ is changed at runtime, it may cause surprising behavior
but doing so is deprecated already anyway.
Co-authored-by: Jean Boussier <[email protected]>
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12975
Diffstat (limited to 'spec/ruby/command_line')
-rwxr-xr-x | spec/ruby/command_line/dash_0_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/command_line/dash_0_spec.rb b/spec/ruby/command_line/dash_0_spec.rb new file mode 100755 index 0000000000..73c5e29004 --- /dev/null +++ b/spec/ruby/command_line/dash_0_spec.rb @@ -0,0 +1,13 @@ +require_relative '../spec_helper' + +describe "The -0 command line option" do + it "sets $/ and $-0" do + ruby_exe("puts $/, $-0", options: "-072").should == ":\n:\n" + end + + ruby_version_is "3.5" do + it "sets $/ and $-0 as a frozen string" do + ruby_exe("puts $/.frozen?, $-0.frozen?", options: "-072").should == "true\ntrue\n" + end + end +end |