From 723318f5d7a6475f69fc0d095a4149547b6050a3 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 6 Oct 2023 17:38:56 +0900 Subject: [ruby/openssl] Exact checks with `assert_include` Where `assert_match` converts string matcher argument to regexp first with escaping, `assert_include` does the same thing simpler. https://github.com/ruby/openssl/commit/81007e0a49 --- test/openssl/test_x509ext.rb | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'test/openssl') diff --git a/test/openssl/test_x509ext.rb b/test/openssl/test_x509ext.rb index 2ff28507e7..59a41ed736 100644 --- a/test/openssl/test_x509ext.rb +++ b/test/openssl/test_x509ext.rb @@ -50,18 +50,16 @@ class OpenSSL::TestX509Extension < OpenSSL::TestCase cdp = ef.create_extension("crlDistributionPoints", "@crlDistPts") assert_equal(false, cdp.critical?) assert_equal("crlDistributionPoints", cdp.oid) - assert_match(%{URI:http://www\.example\.com/crl}, cdp.value) - assert_match( - %r{URI:ldap://ldap\.example\.com/cn=ca\?certificateRevocationList;binary}, - cdp.value) + assert_include(cdp.value, "URI:http://www.example.com/crl") + assert_include(cdp.value, + "URI:ldap://ldap.example.com/cn=ca?certificateRevocationList;binary") cdp = ef.create_extension("crlDistributionPoints", "critical, @crlDistPts") assert_equal(true, cdp.critical?) assert_equal("crlDistributionPoints", cdp.oid) - assert_match(%{URI:http://www.example.com/crl}, cdp.value) - assert_match( - %r{URI:ldap://ldap.example.com/cn=ca\?certificateRevocationList;binary}, - cdp.value) + assert_include(cdp.value, "URI:http://www.example.com/crl") + assert_include(cdp.value, + "URI:ldap://ldap.example.com/cn=ca?certificateRevocationList;binary") cp = ef.create_extension("certificatePolicies", "@certPolicies") assert_equal(false, cp.critical?) -- cgit v1.2.3