mirror of
https://github.com/ruby/ruby.git
synced 2025-08-26 14:34:39 +02:00
enumerator.c: use VALUE
* enumerator.c (inspect_enumerator): use VALUE instead of mere char* by using rb_sprintf() and rb_id2str(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6b6ca88925
commit
8a28e97ae9
3 changed files with 25 additions and 17 deletions
|
@ -391,6 +391,14 @@ class TestEnumerator < Test::Unit::TestCase
|
|||
assert_warning("", bug6214) { [].lazy.inspect }
|
||||
end
|
||||
|
||||
def test_inspect_encoding
|
||||
c = Class.new{define_method("\u{3042}"){}}
|
||||
e = c.new.enum_for("\u{3042}")
|
||||
s = assert_nothing_raised(Encoding::CompatibilityError) {break e.inspect}
|
||||
assert_equal(Encoding::UTF_8, s.encoding)
|
||||
assert_match(/\A#<Enumerator: .*:\u{3042}>\z/, s)
|
||||
end
|
||||
|
||||
def test_generator
|
||||
# note: Enumerator::Generator is a class just for internal
|
||||
g = Enumerator::Generator.new {|y| y << 1 << 2 << 3; :foo }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue