Convert specs for OpenSSL::Digest to shared specs with Digest#1104
Convert specs for OpenSSL::Digest to shared specs with Digest#1104herwinw wants to merge 1 commit intoruby:masterfrom
Conversation
|
Note that some/most of these methods are just from included modules: So in terms of testing coverage I don't think it's so valuable to do that work, i.e., it should be enough to test In fact there are already some specs for |
|
I think the diff is OK but not sure of the value (see previous comment), and since it seems a big effort for little value I'm inclined to close this. |
This is going to take a bit of time, so I would like to have an approval for the idea before I actually spend a few hours on this.
Ruby has two libraries to calculate digests:
digestandopenssl(or the classesDigestenOpenSSL::Digest). The tests for openssl-digest currently use a lot of the constants of the digest, but they could use the specs as well. The current pull request is a little proof of concept for a single spec.That brings us to the next point: the documentation of the OpenSSL::Digest class is weird. When I look at https://www.rubydoc.info/stdlib/openssl/OpenSSL/Digest, the only documented method is
digest. https://docs.ruby-lang.org/en/3.2/OpenSSL/Digest.html describes a few more methods. But it turns out that the OpenSSL::Digest object had methodssizeandlengthtoo, similar to the Digest object. Or the OpenSSL::Digest object has afilemethod too, similar to Digest, but this is not documented. Should these undocumented methods be added to the specs too?