diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-27 12:10:41 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-27 12:10:41 +0000 |
commit | 0cb5fa5877f7b00d1396e0dda4156e8213d37215 (patch) | |
tree | 98225086822c74e28a61a308f8999a627bf182ae /spec/rubyspec/library | |
parent | 819977e4106c64efbcee608300dfe419903c104c (diff) | |
download | ruby-0cb5fa5877f7b00d1396e0dda4156e8213d37215.tar.gz |
Update to ruby/spec@c3e6b90
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/rubyspec/library')
-rw-r--r-- | spec/rubyspec/library/bigdecimal/to_r_spec.rb | 16 | ||||
-rw-r--r-- | spec/rubyspec/library/stringscanner/shared/peek.rb | 5 |
2 files changed, 20 insertions, 1 deletions
diff --git a/spec/rubyspec/library/bigdecimal/to_r_spec.rb b/spec/rubyspec/library/bigdecimal/to_r_spec.rb new file mode 100644 index 0000000000..6f6e5a1bea --- /dev/null +++ b/spec/rubyspec/library/bigdecimal/to_r_spec.rb @@ -0,0 +1,16 @@ +require File.expand_path('../../../spec_helper', __FILE__) +require 'bigdecimal' + +describe "BigDecimal#to_r" do + + it "returns a Rational" do + BigDecimal("3.14159").to_r.should be_kind_of(Rational) + end + + it "returns a Rational with bignum values" do + r = BigDecimal.new("3.141592653589793238462643").to_r + r.numerator.should eql(3141592653589793238462643) + r.denominator.should eql(1000000000000000000000000) + end + +end diff --git a/spec/rubyspec/library/stringscanner/shared/peek.rb b/spec/rubyspec/library/stringscanner/shared/peek.rb index f414cc3b40..418ebb6536 100644 --- a/spec/rubyspec/library/stringscanner/shared/peek.rb +++ b/spec/rubyspec/library/stringscanner/shared/peek.rb @@ -3,12 +3,15 @@ describe :strscan_peek, shared: true do @s = StringScanner.new('This is a test') end - it "returns at most the specified number of characters from the current position" do + it "returns at most the specified number of bytes from the current position" do @s.send(@method, 4).should == "This" @s.pos.should == 0 @s.pos = 5 @s.send(@method, 2).should == "is" @s.send(@method, 1000).should == "is a test" + + s = StringScanner.new("été") + s.send(@method, 2).should == "é" end it "returns an empty string when the passed argument is zero" do |