[前][次][番号順一覧][スレッド一覧]

ruby-changes:63064

From: Yusuke <ko1@a...>
Date: Thu, 24 Sep 2020 19:41:14 +0900 (JST)
Subject: [ruby-changes:63064] 0c611d7f4f (master): test/net/http/test_https.rb: The test logic was buggy

https://git.ruby-lang.org/ruby.git/commit/?id=0c611d7f4f

From 0c611d7f4fce67c64bee4815f263c55ef15561c4 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Thu, 24 Sep 2020 19:39:51 +0900
Subject: test/net/http/test_https.rb: The test logic was buggy

The expected certs must be `[CA_CERT, SERVER_CERT]` before 1.1.1g and
`[SERVER_CERT]` after 1.1.1h.

diff --git a/test/net/http/test_https.rb b/test/net/http/test_https.rb
index 1b8841a..e9aee15 100644
--- a/test/net/http/test_https.rb
+++ b/test/net/http/test_https.rb
@@ -45,8 +45,8 @@ class TestNetHTTPS < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/net/http/test_https.rb#L45
       assert_equal($test_net_http_data, res.body)
     }
     # TODO: OpenSSL 1.1.1h seems to yield only SERVER_CERT; need to check the incompatibility
-    certs.each do |cert|
-      assert_include([SERVER_CERT.to_der, CA_CERT.to_der], cert.to_der)
+    certs.zip([CA_CERT, SERVER_CERT][-certs.size..]) do |actual, expected|
+      assert_equal(expected.to_der, actual.to_der)
     end
   rescue SystemCallError
     skip $!
@@ -66,8 +66,8 @@ class TestNetHTTPS < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/net/http/test_https.rb#L66
       assert_equal($test_net_http_data, res.body)
     }
     # TODO: OpenSSL 1.1.1h seems to yield only SERVER_CERT; need to check the incompatibility
-    certs.each do |cert|
-      assert_include([SERVER_CERT.to_der, CA_CERT.to_der], cert.to_der)
+    certs.zip([CA_CERT, SERVER_CERT][-certs.size..]) do |actual, expected|
+      assert_equal(expected.to_der, actual.to_der)
     end
   end
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]