Add missing hex feature gate

`hex` was previously enabled by `alloc`, now it is optional add the
missing feature gate to tests.
This commit is contained in:
Jamil Lambert, PhD 2025-02-13 19:03:28 +00:00
parent fce0cf1692
commit e7c6564d38
No known key found for this signature in database
GPG Key ID: 54DC29234AB5D2C0
12 changed files with 17 additions and 0 deletions

View File

@ -95,6 +95,7 @@ mod tests {
}
#[cfg(bench)]
#[cfg(feature = "hex")]
mod benches {
use test::Bencher;

View File

@ -47,6 +47,7 @@ impl crate::HashEngine for HashEngine {
mod tests {
#[test]
#[cfg(feature = "alloc")]
#[cfg(feature = "hex")]
fn test() {
use alloc::string::ToString;

View File

@ -107,6 +107,7 @@ where
#[cfg(test)]
#[cfg(feature = "alloc")]
#[cfg(feature = "hex")]
mod tests {
use hex::prelude::{DisplayHex, FromHex};

View File

@ -326,6 +326,7 @@ mod tests {
#[test]
#[cfg(feature = "alloc")]
#[cfg(feature = "hex")]
fn newtype_fmt_roundtrip() {
use alloc::format;

View File

@ -1,5 +1,6 @@
#[test]
#[cfg(feature = "alloc")]
#[cfg(feature = "hex")]
fn test() {
use alloc::string::ToString;

View File

@ -1,5 +1,6 @@
#[test]
#[cfg(feature = "alloc")]
#[cfg(feature = "hex")]
fn test() {
use alloc::string::ToString;

View File

@ -5,6 +5,7 @@ use crate::{sha256, HashEngine};
#[test]
#[cfg(feature = "alloc")]
#[cfg(feature = "hex")]
fn test() {
use alloc::string::ToString;
@ -70,6 +71,7 @@ fn test() {
#[test]
#[cfg(feature = "alloc")]
#[cfg(feature = "hex")]
fn fmt_roundtrips() {
use alloc::format;

View File

@ -45,6 +45,7 @@ mod tests {
#[test]
#[cfg(feature = "alloc")]
#[cfg(feature = "hex")]
fn test() {
use alloc::string::ToString;
@ -98,6 +99,7 @@ mod tests {
#[test]
#[cfg(feature = "alloc")]
#[cfg(feature = "hex")]
fn fmt_roundtrips() {
use alloc::format;

View File

@ -182,10 +182,12 @@ mod tests {
// The digest created by sha256 hashing `&[0]` starting with `TEST_MIDSTATE`.
#[cfg(feature = "alloc")]
#[cfg(feature = "hex")]
const HASH_ZERO_BACKWARD: &str =
"29589d5122ec666ab5b4695070b6debc63881a4f85d88d93ddc90078038213ed";
// And the same thing, forward.
#[cfg(feature = "alloc")]
#[cfg(feature = "hex")]
const HASH_ZERO_FORWARD: &str =
"ed1382037800c9dd938dd8854f1a8863bcdeb6705069b4b56a66ec22519d5829";
@ -198,10 +200,12 @@ mod tests {
// We support manually implementing `Tag` and creating a tagged hash from it.
#[cfg(feature = "alloc")]
#[cfg(feature = "hex")]
pub type TestHash = sha256t::Hash<TestHashTag>;
#[test]
#[cfg(feature = "alloc")]
#[cfg(feature = "hex")]
fn manually_created_sha256t_hash_type() {
use alloc::string::ToString;

View File

@ -41,6 +41,7 @@ impl crate::HashEngine for HashEngine {
mod tests {
#[test]
#[cfg(feature = "alloc")]
#[cfg(feature = "hex")]
fn test() {
use alloc::string::ToString;

View File

@ -1,5 +1,6 @@
#[test]
#[cfg(feature = "alloc")]
#[cfg(feature = "hex")]
fn test() {
use alloc::string::ToString;

View File

@ -51,6 +51,7 @@ impl crate::HashEngine for HashEngine {
mod tests {
#[test]
#[cfg(feature = "alloc")]
#[cfg(feature = "hex")]
fn test() {
use alloc::string::ToString;