1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2018-09-04 03:41:44 +00:00
parent e4b1172833
commit 3fa8d5ba7b
2 changed files with 27 additions and 8 deletions

View file

@ -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

View file

@ -21,7 +21,9 @@ def compile_extension(name)
lib = "#{object_path}/#{ext}.#{RbConfig::CONFIG['DLEXT']}"
ruby_header = "#{RbConfig::CONFIG['rubyhdrdir']}/ruby.h"
libruby_so = RbConfig::CONFIG['LIBRUBY_SO'] if RbConfig::CONFIG["ENABLE_SHARED"] == "yes"
if /mswin|mingw/ =~ RUBY_PLATFORM
libruby_so = RbConfig::CONFIG["LIBRUBY"] if RbConfig::CONFIG["ENABLE_SHARED"] == "yes"
end
begin
mtime = File.mtime(lib)
rescue Errno::ENOENT