diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-04 03:41:44 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-04 03:41:44 +0000 |
commit | 3fa8d5ba7bb4d380ab61684dfa048f2e7eb4c570 (patch) | |
tree | 6b4d7c9b92db9279b7e9ac399f31fe11c959016d /spec/ruby/core | |
parent | e4b1172833afd680105bc067a4db0942273df53a (diff) | |
download | ruby-3fa8d5ba7bb4d380ab61684dfa048f2e7eb4c570.tar.gz |
Spec updates [Bug #15060] [Fix GH-1495]
From: MSP-Greg <greg.mpls@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core')
-rw-r--r-- | spec/ruby/core/encoding/converter/search_convpath_spec.rb | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/spec/ruby/core/encoding/converter/search_convpath_spec.rb b/spec/ruby/core/encoding/converter/search_convpath_spec.rb index 1f1438f756..0e305a1236 100644 --- a/spec/ruby/core/encoding/converter/search_convpath_spec.rb +++ b/spec/ruby/core/encoding/converter/search_convpath_spec.rb @@ -1,11 +1,20 @@ +# frozen_string_literal: true + require_relative '../../../spec_helper' with_feature :encoding do describe "Encoding::Converter.search_convpath" do before :all do - @perms = Encoding.name_list.permutation(2).map do |pair| - Encoding::Converter.search_convpath(pair.first, pair.last) rescue [] - end + t = [] + temp = ''.dup +# Encoding.list.reject { |e| e.dummy? }.map { |e| e.to_s }.permutation(2).each { |a| t << a if Array === a } +# Encoding.list.map { |e| e.to_s }.permutation(2).each { |a| t << a if Array === a } +# Encoding.name_list.permutation(2).each { |a| t << a if Array === a } + Encoding.name_list.permutation(2).each { |a| t << a if Array === a } + @perms = t.map do |a, b| + temp << "#{a.ljust(15)} #{b}" + Encoding::Converter.search_convpath(a, b) rescue nil + end.compact end it "returns an Array" do @@ -64,10 +73,18 @@ with_feature :encoding do end it "raises an Encoding::ConverterNotFoundError if no conversion path exists" do - lambda do - Encoding::Converter.search_convpath( - Encoding::ASCII_8BIT, Encoding::Emacs_Mule) - end.should raise_error(Encoding::ConverterNotFoundError) +# lambda do +# Encoding::Converter.search_convpath( +# Encoding::ASCII_8BIT, Encoding::Emacs_Mule) +# end.should raise_error(Encoding::ConverterNotFoundError) + begin + Encoding::Converter.search_convpath(Encoding::ASCII_8BIT.to_s, Encoding::Emacs_Mule) + rescue => e + e.class.should == Encoding::ConverterNotFoundError + else + e.class.should == Encoding::ConverterNotFoundError + end + end end end |