diff options
author | Benoit Daloze <eregontp@gmail.com> | 2024-02-26 14:45:30 +0100 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2024-02-26 14:45:30 +0100 |
commit | 815db5c0289f5bbea2af275933ba6a4bf60a6967 (patch) | |
tree | db319dbcc035e4248ee25c47916c6e0c1171164b /spec/ruby/core/string | |
parent | 40c9a3dad5bc18213eb9b5ad21aa00580c12c77b (diff) |
Update to ruby/spec@3a510bb
Diffstat (limited to 'spec/ruby/core/string')
-rw-r--r-- | spec/ruby/core/string/to_i_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/ruby/core/string/to_i_spec.rb b/spec/ruby/core/string/to_i_spec.rb index e4fa89aab3..9931502baa 100644 --- a/spec/ruby/core/string/to_i_spec.rb +++ b/spec/ruby/core/string/to_i_spec.rb @@ -10,6 +10,18 @@ describe "String#to_i" do "1_2_3asdf".to_i.should == 123 end + it "ignores multiple non-consecutive underscoes when the first digit is 0" do + (2..16).each do |base| + "0_0_010".to_i(base).should == base; + end + end + + it "bails out at the first double underscore if the first digit is 0" do + (2..16).each do |base| + "010__1".to_i(base).should == base; + end + end + it "ignores leading whitespaces" do [ " 123", " 123", "\r\n\r\n123", "\t\t123", "\r\n\t\n123", " \t\n\r\t 123"].each do |str| |