Skip to content

Commit

Permalink
Add test for String#to_r with leading plus sign
Browse files Browse the repository at this point in the history
  • Loading branch information
herwinw committed Feb 13, 2025
1 parent 517f875 commit 585f032
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/string/to_r_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
"-20".to_r.should == Rational(-20, 1)
end

it "accepts leading plus signs" do
"+20".to_r.should == Rational(20, 1)
end

it "does not treat a leading period without a numeric prefix as a decimal point" do
".9".to_r.should_not == Rational(8106479329266893, 9007199254740992)
end
Expand Down

0 comments on commit 585f032

Please sign in to comment.