Update to openssl-ruby-tests-20210625

This commit is contained in:
tb 2021-06-25 18:45:16 +00:00
parent 962e774177
commit 1d67f8b165
3 changed files with 72 additions and 5 deletions

View File

@ -1,14 +1,14 @@
# $OpenBSD: Makefile,v 1.5 2021/06/15 06:49:01 tb Exp $
# $OpenBSD: Makefile,v 1.6 2021/06/25 18:45:16 tb Exp $
COMMENT = sources of the Ruby OpenSSL gem for regression testing
# Follows HEAD
VERSION = 20210615
VERSION = 20210625
DISTNAME = openssl-ruby-tests-${VERSION}
GH_ACCOUNT = ruby
GH_PROJECT = openssl
GH_COMMIT = 69786e3a666b79c64e0109fa2282ecd359ad4de5
GH_COMMIT = a4ea0c2bb0b3fd40c2ffd75e3c6a06cbfdd5425a
CATEGORIES = security devel

View File

@ -1,2 +1,2 @@
SHA256 (openssl-ruby-tests-20210615-69786e3a.tar.gz) = Rj4sTCDLc7i3MiBQmePg5AUXKyi35Zh9YgxzRYfUmPU=
SIZE (openssl-ruby-tests-20210615-69786e3a.tar.gz) = 299121
SHA256 (openssl-ruby-tests-20210625-a4ea0c2b.tar.gz) = iRORqFgOGTBPRGfrqOwgP8x2Ec5lNhqiKdNF7PdXwxc=
SIZE (openssl-ruby-tests-20210625-a4ea0c2b.tar.gz) = 298663

View File

@ -0,0 +1,67 @@
$OpenBSD: patch-test_openssl_envutil_rb,v 1.1 2021/06/25 18:45:16 tb Exp $
Try to avoid relying on the test-unit gem for now. This reverts
https://github.com/ruby/openssl/commit/7e45e3899d1e3aa87826d7d61f6ebad4f1691e6b
Index: test/openssl/envutil.rb
--- test/openssl/envutil.rb.orig
+++ test/openssl/envutil.rb
@@ -282,6 +282,58 @@ eom
end
values
end
+
+ def mu_pp(obj) #:nodoc:
+ obj.pretty_inspect.chomp
+ end
+
+ # :call-seq:
+ # assert_raise_with_message(exception, expected, msg = nil, &block)
+ #
+ #Tests if the given block raises an exception with the expected
+ #message.
+ #
+ # assert_raise_with_message(RuntimeError, "foo") do
+ # nil #Fails, no Exceptions are raised
+ # end
+ #
+ # assert_raise_with_message(RuntimeError, "foo") do
+ # raise ArgumentError, "foo" #Fails, different Exception is raised
+ # end
+ #
+ # assert_raise_with_message(RuntimeError, "foo") do
+ # raise "bar" #Fails, RuntimeError is raised but the message differs
+ # end
+ #
+ # assert_raise_with_message(RuntimeError, "foo") do
+ # raise "foo" #Raises RuntimeError with the message, so assertion succeeds
+ # end
+ def assert_raise_with_message(exception, expected, msg = nil, &block)
+ case expected
+ when String
+ assert = :assert_equal
+ when Regexp
+ assert = :assert_match
+ else
+ raise TypeError, "Expected #{expected.inspect} to be a kind of String or Regexp, not #{expected.class}"
+ end
+
+ ex = m = nil
+ ex = assert_raise(exception, msg || "Exception(#{exception}) with message matches to #{expected.inspect}") do
+ yield
+ end
+ m = ex.message
+ msg = message(msg, "") {"Expected Exception(#{exception}) was raised, but the message doesn't match"}
+
+ if assert == :assert_equal
+ assert_equal(expected, m, msg)
+ else
+ msg = message(msg) { "Expected #{mu_pp expected} to match #{mu_pp m}" }
+ assert expected =~ m, msg
+ block.binding.eval("proc{|_|$~=_}").call($~)
+ end
+ ex
+ end
end
end
end