mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/digest/digest.c (rb_digest_class_init): Define
Digest::Class.new(). [Feature #3954] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0a8d8b8a68
commit
74cacd0df4
3 changed files with 19 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Oct 18 13:18:01 2010 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* ext/digest/digest.c (rb_digest_class_init): Define
|
||||
Digest::Class.new(). [Feature #3954]
|
||||
|
||||
Mon Oct 18 12:00:12 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* pack.c (pack_pack): Add native size option ! to q and Q.
|
||||
|
|
|
@ -415,6 +415,13 @@ rb_digest_class_s_hexdigest(int argc, VALUE *argv, VALUE klass)
|
|||
return hexencode_str_new(rb_funcall2(klass, id_digest, argc, argv));
|
||||
}
|
||||
|
||||
/* :nodoc: */
|
||||
static VALUE
|
||||
rb_digest_class_init(VALUE self)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* Document-class: Digest::Base
|
||||
*
|
||||
|
@ -622,6 +629,7 @@ Init_digest(void)
|
|||
* class Digest::Class
|
||||
*/
|
||||
rb_cDigest_Class = rb_define_class_under(rb_mDigest, "Class", rb_cObject);
|
||||
rb_define_method(rb_cDigest_Class, "initialize", rb_digest_class_init, 0);
|
||||
rb_include_module(rb_cDigest_Class, rb_mDigest_Instance);
|
||||
|
||||
/* class methods */
|
||||
|
|
|
@ -17,6 +17,12 @@ module TestDigest
|
|||
Data1 = "abc"
|
||||
Data2 = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
|
||||
|
||||
def test_s_new
|
||||
self.class::DATA.each do |str, hexdigest|
|
||||
assert_raise(ArgumentError) { self.class::ALGO.new("") }
|
||||
end
|
||||
end
|
||||
|
||||
def test_s_hexdigest
|
||||
self.class::DATA.each do |str, hexdigest|
|
||||
assert_equal(hexdigest, self.class::ALGO.hexdigest(str))
|
||||
|
|
Loading…
Reference in a new issue