Sha256: 27e162b3b77779a7168528adf076958fc9977f102c1d3c4b1688d9d3ff9a0550
Contents?: true
Size: 1021 Bytes
Versions: 83
Compression:
Stored size: 1021 Bytes
Contents
# encoding: utf-8 require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../spec_helper' require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/fixtures/classes' ruby_version_is '1.8.7' do describe "String#each_char" do it "passes each char in self to the given block" do a = [] "hello".each_char { |c| a << c } a.should == ['h', 'e', 'l', 'l', 'o'] end ruby_bug 'redmine #1487', '1.9.1' do it "returns self" do s = StringSpecs::MyString.new "hello" s.each_char{}.should equal(s) end end it "returns an enumerator when no block given" do enum = "hello".each_char enum.should be_kind_of(enumerator_class) enum.to_a.should == ['h', 'e', 'l', 'l', 'o'] end it "is unicode aware" do before = $KCODE $KCODE = "UTF-8" "\303\207\342\210\202\303\251\306\222g".each_char.to_a.should == ["\303\207", "\342\210\202", "\303\251", "\306\222", "g"] $KCODE = before end end end
Version data entries
83 entries across 83 versions & 1 rubygems