summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/to_c_spec.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2023-05-29 15:27:57 +0200
committerBenoit Daloze <eregontp@gmail.com>2023-05-29 15:27:57 +0200
commitc48d496e8cfdf8243d2beb28623954003adaf7fc (patch)
tree2d53327b3126360ccb42f9dae9889b7f329ad035 /spec/ruby/core/string/to_c_spec.rb
parent98f500d0958d12b1909f4638abf33682d75f3fe6 (diff)
Update to ruby/spec@c3677cf
Diffstat (limited to 'spec/ruby/core/string/to_c_spec.rb')
-rw-r--r--spec/ruby/core/string/to_c_spec.rb12
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