summaryrefslogtreecommitdiff
path: root/spec/ruby/library
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-08-28 20:26:02 +0200
committerBenoit Daloze <eregontp@gmail.com>2020-08-28 20:26:02 +0200
commitb49307c701911a713cbdb48367833d3661a4880a (patch)
tree75674a3f22bee0b347b3efbbcc160bc7a637b8e3 /spec/ruby/library
parent3dd63108b0e7551aba76eba85a459b58ec971ccb (diff)
Update to ruby/spec@335eb9b
Diffstat (limited to 'spec/ruby/library')
-rw-r--r--spec/ruby/library/cgi/unescapeHTML_spec.rb5
-rw-r--r--spec/ruby/library/rbconfig/rbconfig_spec.rb15
-rw-r--r--spec/ruby/library/socket/tcpsocket/gethostbyname_spec.rb16
3 files changed, 24 insertions, 12 deletions
diff --git a/spec/ruby/library/cgi/unescapeHTML_spec.rb b/spec/ruby/library/cgi/unescapeHTML_spec.rb
index 46387d4f01..84b30c6aa6 100644
--- a/spec/ruby/library/cgi/unescapeHTML_spec.rb
+++ b/spec/ruby/library/cgi/unescapeHTML_spec.rb
@@ -36,4 +36,9 @@ describe "CGI.unescapeHTML" do
input = "fooooooo&#"
CGI.unescapeHTML(input).should == input
end
+
+ it "unescapes invalid encoding" do
+ input = "\xFF&"
+ CGI.unescapeHTML(input).should == input
+ end
end
diff --git a/spec/ruby/library/rbconfig/rbconfig_spec.rb b/spec/ruby/library/rbconfig/rbconfig_spec.rb
index 015c2972b2..b3b8f32edb 100644
--- a/spec/ruby/library/rbconfig/rbconfig_spec.rb
+++ b/spec/ruby/library/rbconfig/rbconfig_spec.rb
@@ -59,16 +59,15 @@ describe 'RbConfig::CONFIG' do
out.should_not be_empty
end
- require 'tempfile'
it "['STRIP'] exists and can be executed" do
strip = RbConfig::CONFIG.fetch('STRIP')
- Tempfile.open('sh') do |dst|
- File.open('/bin/sh', 'rb') do |src|
- IO.copy_stream(src, dst)
- dst.flush
- out =`#{strip} #{dst.to_path}`
- $?.should.success?
- end
+ copy = tmp("sh")
+ cp '/bin/sh', copy
+ begin
+ out = `#{strip} #{copy}`
+ $?.should.success?
+ ensure
+ rm_r copy
end
end
end
diff --git a/spec/ruby/library/socket/tcpsocket/gethostbyname_spec.rb b/spec/ruby/library/socket/tcpsocket/gethostbyname_spec.rb
index 703abff81c..f0e98778f5 100644
--- a/spec/ruby/library/socket/tcpsocket/gethostbyname_spec.rb
+++ b/spec/ruby/library/socket/tcpsocket/gethostbyname_spec.rb
@@ -4,7 +4,9 @@ require_relative '../fixtures/classes'
# TODO: verify these for windows
describe "TCPSocket#gethostbyname" do
before :each do
- @host_info = TCPSocket.gethostbyname(SocketSpecs.hostname)
+ suppress_warning do
+ @host_info = TCPSocket.gethostbyname(SocketSpecs.hostname)
+ end
end
it "returns an array elements of information on the hostname" do
@@ -52,13 +54,17 @@ end
describe 'TCPSocket#gethostbyname' do
it 'returns an Array' do
- TCPSocket.gethostbyname('127.0.0.1').should be_an_instance_of(Array)
+ suppress_warning do
+ TCPSocket.gethostbyname('127.0.0.1').should be_an_instance_of(Array)
+ end
end
describe 'using a hostname' do
describe 'the returned Array' do
before do
- @array = TCPSocket.gethostbyname('127.0.0.1')
+ suppress_warning do
+ @array = TCPSocket.gethostbyname('127.0.0.1')
+ end
end
it 'includes the canonical name as the 1st value' do
@@ -88,7 +94,9 @@ describe 'TCPSocket#gethostbyname' do
SocketSpecs.each_ip_protocol do |family, ip_address|
describe 'the returned Array' do
before do
- @array = TCPSocket.gethostbyname(ip_address)
+ suppress_warning do
+ @array = TCPSocket.gethostbyname(ip_address)
+ end
end
it 'includes the IP address as the 1st value' do