[3781] MacRuby/trunk/spec/frozen/library/digest
Revision: 3781 http://trac.macosforge.org/projects/ruby/changeset/3781 Author: lsansonetti@apple.com Date: 2010-03-16 17:32:04 -0700 (Tue, 16 Mar 2010) Log Message: ----------- fix digest length specs for 1.9, since the constant strings are UTF-8 encoded, their length is not the same Modified Paths: -------------- MacRuby/trunk/spec/frozen/library/digest/md5/shared/length.rb MacRuby/trunk/spec/frozen/library/digest/sha256/shared/length.rb MacRuby/trunk/spec/frozen/library/digest/sha384/shared/length.rb MacRuby/trunk/spec/frozen/library/digest/sha512/shared/length.rb Modified: MacRuby/trunk/spec/frozen/library/digest/md5/shared/length.rb =================================================================== --- MacRuby/trunk/spec/frozen/library/digest/md5/shared/length.rb 2010-03-17 00:30:34 UTC (rev 3780) +++ MacRuby/trunk/spec/frozen/library/digest/md5/shared/length.rb 2010-03-17 00:32:04 UTC (rev 3781) @@ -1,8 +1,19 @@ describe :md5_length, :shared => true do - it 'returns the length of the digest' do - cur_digest = Digest::MD5.new - cur_digest.send(@method).should == MD5Constants::BlankDigest.size - cur_digest << MD5Constants::Contents - cur_digest.send(@method).should == MD5Constants::Digest.size + ruby_version_is "" ... "1.9" do + it 'returns the length of the digest' do + cur_digest = Digest::MD5.new + cur_digest.send(@method).should == MD5Constants::BlankDigest.size + cur_digest << MD5Constants::Contents + cur_digest.send(@method).should == MD5Constants::Digest.size + end end + + ruby_version_is "1.9" do + it 'returns the length of the digest' do + cur_digest = Digest::MD5.new + cur_digest.send(@method).should == MD5Constants::BlankDigest.dup.force_encoding('ascii-8bit').size + cur_digest << MD5Constants::Contents + cur_digest.send(@method).should == MD5Constants::Digest.dup.force_encoding('ascii-8bit').size + end + end end Modified: MacRuby/trunk/spec/frozen/library/digest/sha256/shared/length.rb =================================================================== --- MacRuby/trunk/spec/frozen/library/digest/sha256/shared/length.rb 2010-03-17 00:30:34 UTC (rev 3780) +++ MacRuby/trunk/spec/frozen/library/digest/sha256/shared/length.rb 2010-03-17 00:32:04 UTC (rev 3781) @@ -1,8 +1,18 @@ describe :sha256_length, :shared => true do - it 'returns the length of the digest' do - cur_digest = Digest::SHA256.new - cur_digest.send(@method).should == SHA256Constants::BlankDigest.size - cur_digest << SHA256Constants::Contents - cur_digest.send(@method).should == SHA256Constants::Digest.size + ruby_version_is "" ... "1.9" do + it 'returns the length of the digest' do + cur_digest = Digest::SHA256.new + cur_digest.send(@method).should == SHA256Constants::BlankDigest.size + cur_digest << SHA256Constants::Contents + cur_digest.send(@method).should == SHA256Constants::Digest.size + end end + ruby_version_is "1.9" do + it 'returns the length of the digest' do + cur_digest = Digest::SHA256.new + cur_digest.send(@method).should == SHA256Constants::BlankDigest.dup.force_encoding('ascii-8bit').size + cur_digest << SHA256Constants::Contents + cur_digest.send(@method).should == SHA256Constants::Digest.dup.force_encoding('ascii-8bit').size + end + end end Modified: MacRuby/trunk/spec/frozen/library/digest/sha384/shared/length.rb =================================================================== --- MacRuby/trunk/spec/frozen/library/digest/sha384/shared/length.rb 2010-03-17 00:30:34 UTC (rev 3780) +++ MacRuby/trunk/spec/frozen/library/digest/sha384/shared/length.rb 2010-03-17 00:32:04 UTC (rev 3781) @@ -1,8 +1,18 @@ describe :sha384_length, :shared => true do - it 'returns the length of the digest' do - cur_digest = Digest::SHA384.new - cur_digest.send(@method).should == SHA384Constants::BlankDigest.size - cur_digest << SHA384Constants::Contents - cur_digest.send(@method).should == SHA384Constants::Digest.size + ruby_version_is "" ... "1.9" do + it 'returns the length of the digest' do + cur_digest = Digest::SHA384.new + cur_digest.send(@method).should == SHA384Constants::BlankDigest.size + cur_digest << SHA384Constants::Contents + cur_digest.send(@method).should == SHA384Constants::Digest.size + end end + ruby_version_is "1.9" do + it 'returns the length of the digest' do + cur_digest = Digest::SHA384.new + cur_digest.send(@method).should == SHA384Constants::BlankDigest.dup.force_encoding('ascii-8bit').size + cur_digest << SHA384Constants::Contents + cur_digest.send(@method).should == SHA384Constants::Digest.dup.force_encoding('ascii-8bit').size + end + end end Modified: MacRuby/trunk/spec/frozen/library/digest/sha512/shared/length.rb =================================================================== --- MacRuby/trunk/spec/frozen/library/digest/sha512/shared/length.rb 2010-03-17 00:30:34 UTC (rev 3780) +++ MacRuby/trunk/spec/frozen/library/digest/sha512/shared/length.rb 2010-03-17 00:32:04 UTC (rev 3781) @@ -1,8 +1,18 @@ describe :sha512_length, :shared => true do - it 'returns the length of the digest' do - cur_digest = Digest::SHA512.new - cur_digest.send(@method).should == SHA512Constants::BlankDigest.size - cur_digest << SHA512Constants::Contents - cur_digest.send(@method).should == SHA512Constants::Digest.size + ruby_version_is "" ... "1.9" do + it 'returns the length of the digest' do + cur_digest = Digest::SHA512.new + cur_digest.send(@method).should == SHA512Constants::BlankDigest.size + cur_digest << SHA512Constants::Contents + cur_digest.send(@method).should == SHA512Constants::Digest.size + end end + ruby_version_is "1.9" do + it 'returns the length of the digest' do + cur_digest = Digest::SHA512.new + cur_digest.send(@method).should == SHA512Constants::BlankDigest.dup.force_encoding('ascii-8bit').size + cur_digest << SHA512Constants::Contents + cur_digest.send(@method).should == SHA512Constants::Digest.dup.force_encoding('ascii-8bit').size + end + end end
participants (1)
-
source_changes@macosforge.org