diff options
Diffstat (limited to 'spec/ruby/core/string/to_c_spec.rb')
-rw-r--r-- | spec/ruby/core/string/to_c_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/ruby/core/string/to_c_spec.rb b/spec/ruby/core/string/to_c_spec.rb index edc8a4f14f..9d24f1f56c 100644 --- a/spec/ruby/core/string/to_c_spec.rb +++ b/spec/ruby/core/string/to_c_spec.rb @@ -38,4 +38,16 @@ describe "String#to_c" do '79+4i'.encode("UTF-16").to_c }.should raise_error(Encoding::CompatibilityError, "ASCII incompatible encoding: UTF-16") end + + ruby_version_is "3.2" do + it "treats a sequence of underscores as an end of Complex string" do + "5+3_1i".to_c.should == Complex(5, 31) + "5+3__1i".to_c.should == Complex(5) + "5+3___1i".to_c.should == Complex(5) + + "12_3".to_c.should == Complex(123) + "12__3".to_c.should == Complex(12) + "12___3".to_c.should == Complex(12) + end + end end |