summaryrefslogtreecommitdiff
path: root/test/openssl/test_hmac.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2020-02-16 15:21:29 +0900
committerGitHub <[email protected]>2020-02-16 15:21:29 +0900
commitb99775b163ce44079c1f8727ce9b4ed8bb03489d (patch)
tree4f9fd53f21c94dfeb05fefe1143bbe770228733a /test/openssl/test_hmac.rb
parent0bfa479c52963b95a47ceab3d453f21b646366a2 (diff)
Import openssl-2.2.0 (#2693)
Import the master branch of ruby/openssl for preparing to release openssl-2.2.0
Notes
Notes: Merged-By: hsbt <[email protected]>
Diffstat (limited to 'test/openssl/test_hmac.rb')
-rw-r--r--test/openssl/test_hmac.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/openssl/test_hmac.rb b/test/openssl/test_hmac.rb
index 831a5b6b37..9cb3c5a864 100644
--- a/test/openssl/test_hmac.rb
+++ b/test/openssl/test_hmac.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'utils'
if defined?(OpenSSL)
@@ -39,6 +39,16 @@ class OpenSSL::TestHMAC < OpenSSL::TestCase
second = h1.update("test").hexdigest
assert_equal first, second
end
+
+ def test_eq
+ h1 = OpenSSL::HMAC.new("KEY", "MD5")
+ h2 = OpenSSL::HMAC.new("KEY", OpenSSL::Digest.new("MD5"))
+ h3 = OpenSSL::HMAC.new("FOO", "MD5")
+
+ assert_equal h1, h2
+ refute_equal h1, h2.digest
+ refute_equal h1, h3
+ end
end
end