Check .dup state when Stateful
This commit is contained in:
parent
0b966714b6
commit
53b44e6ecd
@ -1,4 +1,11 @@
|
||||
module Crypto
|
||||
module Secret
|
||||
module Stateless
|
||||
end
|
||||
|
||||
module Stateful
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
require "crypto/subtle"
|
||||
|
@ -66,7 +66,9 @@ module Crypto::Secret
|
||||
end
|
||||
|
||||
# WARNING: Not thread safe
|
||||
private def set_state(new_state : State)
|
||||
# Kept public for .dup
|
||||
# :nodoc:
|
||||
def set_state(new_state : State)
|
||||
return if @state == new_state
|
||||
|
||||
case new_state
|
||||
|
@ -56,9 +56,11 @@ macro test_secret_class(to sclass)
|
||||
secret1 = sclass.copy_from key
|
||||
secret2 = secret1.dup
|
||||
(secret1 == secret2).should be_true
|
||||
end
|
||||
|
||||
pending "check dup state" { }
|
||||
if secret1.is_a?(Crypto::Secret::Stateful) && secret2.is_a?(Crypto::Secret::Stateful)
|
||||
secret1.@state.should eq secret2.@state
|
||||
end
|
||||
end
|
||||
|
||||
it "bytesize" do
|
||||
secret = sclass.new 5
|
||||
|
Loading…
Reference in New Issue
Block a user