MCPcopy Create free account
hub / github.com/06chaynes/http-cache / test_errors

Function test_errors

http-cache-reqwest/src/test.rs:47–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45
46const CACHEABLE_PUBLIC: &str = "max-age=86400, public";
47
48#[test]
49#[allow(clippy::default_constructed_unit_structs)]
50fn test_errors() -> Result<()> {
51 // Testing the Debug, Default, and Clone traits for the error types
52 let br = BadRequest::default();
53 assert_eq!(format!("{:?}", br.clone()), "BadRequest",);
54 assert_eq!(
55 br.to_string(),
56 "Request object is not cloneable. Are you passing a streaming body?"
57 .to_string(),
58 );
59
60 // Test HttpCacheError
61 let reqwest_err = HttpCacheError::cache("test cache error".to_string());
62 assert!(format!("{:?}", reqwest_err).contains("Cache"));
63 assert_eq!(
64 reqwest_err.to_string(),
65 "Cache error: test cache error".to_string(),
66 );
67 Ok(())
68}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected