diff --git a/cavp/tests/shavs.rs b/cavp/tests/shavs.rs index 5594715799..0015858bbc 100644 --- a/cavp/tests/shavs.rs +++ b/cavp/tests/shavs.rs @@ -21,7 +21,8 @@ use wasm_bindgen_test::wasm_bindgen_test_configure; wasm_bindgen_test_configure!(run_in_browser); mod digest_shavs { - use ring::{digest, test}; + use ring::digest; + use ring::test; fn run_known_answer_test(digest_alg: &'static digest::Algorithm, test_file: test::File) { let section_name = &format!("L = {}", digest_alg.output_len()); diff --git a/src/arithmetic/bigint.rs b/src/arithmetic/bigint.rs index 8d16890749..d5d7ea1f12 100644 --- a/src/arithmetic/bigint.rs +++ b/src/arithmetic/bigint.rs @@ -833,7 +833,8 @@ fn unwrap_impossible_limb_slice_error(err: LimbSliceError) { #[cfg(test)] mod tests { use super::*; - use crate::{cpu, test}; + use crate::cpu; + use crate::test; // Type-level representation of an arbitrary modulus. struct M {} diff --git a/src/digest.rs b/src/digest.rs index 857f673f86..e771237786 100644 --- a/src/digest.rs +++ b/src/digest.rs @@ -287,20 +287,6 @@ impl Context { } /// Returns the digest of `data` using the given digest algorithm. -/// -/// # Examples: -/// -/// ``` -/// # #[cfg(feature = "alloc")] -/// # { -/// use ring::{digest, test}; -/// let expected_hex = "09ca7e4eaa6e8ae9c7d261167129184883644d07dfba7cbfbc4c8a2e08360d5b"; -/// let expected: Vec = test::from_hex(expected_hex).unwrap(); -/// let actual = digest::digest(&digest::SHA256, b"hello, world"); -/// -/// assert_eq!(&expected, &actual.as_ref()); -/// # } -/// ``` pub fn digest(algorithm: &'static Algorithm, data: &[u8]) -> Digest { let cpu = cpu::features(); Digest::compute_from(algorithm, data, cpu) diff --git a/src/ec/suite_b/ecdh.rs b/src/ec/suite_b/ecdh.rs index 2ffb188b45..785c99204e 100644 --- a/src/ec/suite_b/ecdh.rs +++ b/src/ec/suite_b/ecdh.rs @@ -147,7 +147,8 @@ fn ecdh( #[cfg(test)] mod tests { use super::super::ops; - use crate::{agreement, ec, limb, test}; + use crate::test; + use crate::{agreement, ec, limb}; static SUPPORTED_SUITE_B_ALGS: [(&str, &agreement::Algorithm, &ec::Curve, &ops::CommonOps); 2] = [ ( diff --git a/src/ec/suite_b/ecdsa/digest_scalar.rs b/src/ec/suite_b/ecdsa/digest_scalar.rs index acc4276795..bd78db1641 100644 --- a/src/ec/suite_b/ecdsa/digest_scalar.rs +++ b/src/ec/suite_b/ecdsa/digest_scalar.rs @@ -68,7 +68,8 @@ fn digest_scalar_(n: &Modulus, digest: &[u8]) -> Scalar { #[cfg(test)] mod tests { use super::digest_bytes_scalar; - use crate::{cpu, digest, ec::suite_b::ops::*, limb, test}; + use crate::test; + use crate::{cpu, digest, ec::suite_b::ops::*, limb}; #[test] fn test() { diff --git a/src/ec/suite_b/ecdsa/signing.rs b/src/ec/suite_b/ecdsa/signing.rs index a82f6ee8b0..60754e0dfa 100644 --- a/src/ec/suite_b/ecdsa/signing.rs +++ b/src/ec/suite_b/ecdsa/signing.rs @@ -526,7 +526,8 @@ static EC_PUBLIC_KEY_P384_PKCS8_V1_TEMPLATE: pkcs8::Template = pkcs8::Template { #[cfg(test)] mod tests { - use crate::{rand, signature, test}; + use crate::test; + use crate::{rand, signature}; #[test] fn signature_ecdsa_sign_fixed_test() { diff --git a/src/ec/suite_b/public_key.rs b/src/ec/suite_b/public_key.rs index e48b17854e..1d9191b5e4 100644 --- a/src/ec/suite_b/public_key.rs +++ b/src/ec/suite_b/public_key.rs @@ -68,7 +68,8 @@ pub(super) fn parse_uncompressed_point( #[cfg(test)] mod tests { use super::*; - use crate::{cpu, test}; + use crate::cpu; + use crate::test; #[test] fn parse_uncompressed_point_test() { diff --git a/src/lib.rs b/src/lib.rs index 04a2e1e7dc..1a582e24c4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -100,8 +100,13 @@ mod debug; #[macro_use] mod prefixed; +#[doc(hidden)] #[macro_use] -pub mod test; +pub mod testutil_internal_unstable; + +#[deprecated(note = "internal API that will be removed")] +#[doc(hidden)] +pub use testutil_internal_unstable as test; #[macro_use] mod bssl; diff --git a/src/polyfill/notsend.rs b/src/polyfill/notsend.rs index 6f18b2ee16..c2760292de 100644 --- a/src/polyfill/notsend.rs +++ b/src/polyfill/notsend.rs @@ -23,6 +23,8 @@ impl NotSend { pub const VALUE: Self = Self(PhantomData); } +#[allow(deprecated)] const _: () = test::compile_time_assert_clone::(); +#[allow(deprecated)] const _: () = test::compile_time_assert_copy::(); const _: () = assert!(size_of::() == 0); diff --git a/src/rsa/padding.rs b/src/rsa/padding.rs index 628c9d06a7..897822ffee 100644 --- a/src/rsa/padding.rs +++ b/src/rsa/padding.rs @@ -81,7 +81,8 @@ fn mgf1(digest_alg: &'static digest::Algorithm, seed: &[u8], out: &mut [u8]) { #[cfg(test)] mod test { use super::*; - use crate::{digest, error, test}; + use crate::test; + use crate::{digest, error}; use alloc::vec; #[test] diff --git a/src/test.rs b/src/testutil_internal_unstable.rs similarity index 99% rename from src/test.rs rename to src/testutil_internal_unstable.rs index 62edd30e41..443dac424d 100644 --- a/src/test.rs +++ b/src/testutil_internal_unstable.rs @@ -90,7 +90,7 @@ //! a = 2b11cb945c8cf152ffa4c9c2b1c965b019b35d0b7626919ef0ae6cb9d232f8af //! b = 18905f76a53755c679fb732b7762251075ba95fc5fedb60179e730d418a9143c //! r = 18905f76a53755c679fb732b7762251075ba95fc5fedb60179e730d418a9143c -//! thread 'example_test' panicked at 'Test failed.', src\test.rs:206 +//! thread 'example_test' panicked at 'Test failed.', src\testutil:206 //! stack backtrace: //! 0: 0x7ff654a05c7c - std::rt::lang_start::h61f4934e780b4dfc //! 1: 0x7ff654a04f32 - std::rt::lang_start::h61f4934e780b4dfc @@ -295,7 +295,7 @@ impl TestCase { #[macro_export] macro_rules! test_file { ($file_name:expr) => { - $crate::test::File { + $crate::testutil_internal_unstable::File { file_name: $file_name, contents: include_str!($file_name), } @@ -538,7 +538,8 @@ pub mod rand { #[cfg(test)] mod tests { - use crate::{error, test}; + use crate::error; + use crate::test; #[test] fn one_ok() { diff --git a/tests/aead_tests.rs b/tests/aead_tests.rs index 1d14508719..d2b2ac382a 100644 --- a/tests/aead_tests.rs +++ b/tests/aead_tests.rs @@ -21,7 +21,8 @@ use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure}; wasm_bindgen_test_configure!(run_in_browser); use core::ops::RangeFrom; -use ring::{aead, error, test, test_file}; +use ring::{aead, error}; +use ring::{test, test_file}; /// Generate the known answer test functions for the given algorithm and test /// case input file, where each test is implemented by a test in `$test`. diff --git a/tests/agreement_tests.rs b/tests/agreement_tests.rs index 465ebb626d..eb0c18aca5 100644 --- a/tests/agreement_tests.rs +++ b/tests/agreement_tests.rs @@ -22,7 +22,8 @@ wasm_bindgen_test_configure!(run_in_browser); extern crate alloc; -use ring::{agreement, error, rand, test, test_file}; +use ring::{agreement, error, rand}; +use ring::{test, test_file}; #[test] fn agreement_traits() { diff --git a/tests/digest_tests.rs b/tests/digest_tests.rs index 9a57d61006..3bed54dd7f 100644 --- a/tests/digest_tests.rs +++ b/tests/digest_tests.rs @@ -14,7 +14,8 @@ #![allow(missing_docs)] -use ring::{digest, test, test_file}; +use ring::digest; +use ring::{test, test_file}; #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure}; diff --git a/tests/ecdsa_tests.rs b/tests/ecdsa_tests.rs index 2c3fdf9ab8..5ace245e58 100644 --- a/tests/ecdsa_tests.rs +++ b/tests/ecdsa_tests.rs @@ -17,8 +17,8 @@ use ring::{ rand, signature::{self, KeyPair}, - test, test_file, }; +use ring::{test, test_file}; // ECDSA *signing* tests are in src/ec/ecdsa/signing.rs. diff --git a/tests/ed25519_tests.rs b/tests/ed25519_tests.rs index 9375cbb9e6..f3a1e8ddc7 100644 --- a/tests/ed25519_tests.rs +++ b/tests/ed25519_tests.rs @@ -17,8 +17,8 @@ use ring::{ error, rand, signature::{self, Ed25519KeyPair, KeyPair}, - test, test_file, }; +use ring::{test, test_file}; #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure}; diff --git a/tests/error_tests.rs b/tests/error_tests.rs index ac10c87744..5fe7cea6b0 100644 --- a/tests/error_tests.rs +++ b/tests/error_tests.rs @@ -3,7 +3,9 @@ #[cfg(feature = "std")] #[test] fn error_impl_std_error_error_test() { - use ring::{error, test}; + use ring::error; + use ring::test; + test::compile_time_assert_std_error_error::(); test::compile_time_assert_std_error_error::(); } diff --git a/tests/hkdf_tests.rs b/tests/hkdf_tests.rs index 93234bfe58..ea5e7e3d9c 100644 --- a/tests/hkdf_tests.rs +++ b/tests/hkdf_tests.rs @@ -14,7 +14,8 @@ #![allow(missing_docs)] -use ring::{digest, error, hkdf, test, test_file}; +use ring::{digest, error, hkdf}; +use ring::{test, test_file}; #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure}; diff --git a/tests/hmac_tests.rs b/tests/hmac_tests.rs index 7097ae4cd6..03860446cf 100644 --- a/tests/hmac_tests.rs +++ b/tests/hmac_tests.rs @@ -14,7 +14,8 @@ #![allow(missing_docs)] -use ring::{digest, hmac, test, test_file}; +use ring::{digest, hmac}; +use ring::{test, test_file}; #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure}; diff --git a/tests/pbkdf2_tests.rs b/tests/pbkdf2_tests.rs index 9bb111e400..0117b1617e 100644 --- a/tests/pbkdf2_tests.rs +++ b/tests/pbkdf2_tests.rs @@ -15,7 +15,8 @@ #![allow(missing_docs)] use core::num::NonZeroU32; -use ring::{digest, error, pbkdf2, test, test_file}; +use ring::{digest, error, pbkdf2}; +use ring::{test, test_file}; #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure}; diff --git a/tests/quic_tests.rs b/tests/quic_tests.rs index 556a16b2bf..c02325d856 100644 --- a/tests/quic_tests.rs +++ b/tests/quic_tests.rs @@ -14,7 +14,8 @@ #![allow(missing_docs)] -use ring::{aead::quic, test, test_file}; +use ring::aead::quic; +use ring::{test, test_file}; #[test] fn quic_aes_128() { diff --git a/tests/rand_tests.rs b/tests/rand_tests.rs index bf2b472309..768d353734 100644 --- a/tests/rand_tests.rs +++ b/tests/rand_tests.rs @@ -14,10 +14,8 @@ #![allow(missing_docs)] -use ring::{ - rand::{self, SecureRandom as _}, - test, -}; +use ring::rand::{self, SecureRandom as _}; +use ring::test; #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure}; diff --git a/tests/rsa_tests.rs b/tests/rsa_tests.rs index 2b8f141245..3383a745a8 100644 --- a/tests/rsa_tests.rs +++ b/tests/rsa_tests.rs @@ -20,8 +20,8 @@ use ring::{ io::der, rand, rsa, signature::{self, KeyPair}, - test, test_file, }; +use ring::{test, test_file}; #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure}; diff --git a/tests/signature_tests.rs b/tests/signature_tests.rs index 16deacd39b..e4d413a535 100644 --- a/tests/signature_tests.rs +++ b/tests/signature_tests.rs @@ -1,6 +1,7 @@ #![allow(missing_docs)] -use ring::{signature, test}; +use ring::signature; +use ring::test; #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure};