Sha256: 12e0b8f0454b6e38c6f871c83c6d3f241e09f061fa2e9af254ab47f73f5d3d3f
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
# -*- encoding : utf-8 -*- require File.dirname(__FILE__) + '/spec_helper' OBJS = ["bla", 'бла', ['bla', 'бла'], nil, {1=>2}] H = {:bla => 'bla', 'бла' => 1, :url => nil, :x => [:a => "идф", :b => true]} describe "encoding-kawai" do if RUBY_VERSION < '1.9' %w{utf8 binary}.each do |enc| OBJS.each do |obj| it "should word for each object to code with #{enc} on obj: #{obj.inspect}" do obj.send("#{enc}!").should == obj end end it "should word for each object to code with #{enc} on obj: #{H.inspect}" do H.send("#{enc}!").should == H end end else %w{utf8 binary}.each do |enc| OBJS.each do |obj| it "should word for each object to code with #{enc} on obj: #{obj.inspect}" do obj.send("#{enc}!").should == obj end end it "should word for each object to code with #{enc} on obj: #{H.inspect}" do str = enc == 'utf8' ? "бла".force_encoding('utf-8') : "бла".force_encoding('binary') str2 = enc == 'utf8' ? "идф".force_encoding('utf-8') : "идф".force_encoding('binary') H.send("#{enc}!").should == {:bla => 'bla', str => 1, :url => nil, :x => [:a => str2, :b => true]} end it "should set encoding" do str = "бла" str.encoding.name.should == "UTF-8" str.send("#{enc}!") if enc == 'utf8' str.encoding.name.should == 'UTF-8' else str.encoding.name.should == 'ASCII-8BIT' end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
encoding-kawai-0.5 | spec/encoding-kawai_spec.rb |