Skip to content

Commit

Permalink
chore: ignore logger and lib in coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
eredotpkfr committed Nov 1, 2024
1 parent 3e77380 commit c286a0b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
4 changes: 3 additions & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ coverage: # https://docs.codecov.com/docs/codecovyml-reference#coverage
patch: off

ignore:
- "src/bin/subscan.rs"
- "src/cli"
- "src/lib.rs"
- "src/logger.rs"
- "src/bin/subscan.rs"
27 changes: 15 additions & 12 deletions src/utilities/serializers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ use serde::Serializer;
/// # Examples
///
/// ```
/// use serde_json::json;
/// use subscan::utilities::serializers::dt_to_string_method;
/// use chrono::DateTime;
/// use serde_json::Serializer;
///
/// let json = json!({
/// "time": DateTime::UNIX_EPOCH.to_string(),
/// });
/// let expected = "{\"time\":\"1970-01-01 00:00:00 UTC\"}";
/// let mut buffer = Vec::new();
/// let mut serializer = Serializer::new(&mut buffer);
///
/// assert_eq!(serde_json::to_string(&json).unwrap(), expected);
/// let serialized = dt_to_string_method(&DateTime::UNIX_EPOCH, &mut serializer);
/// let expected = "\"1970-01-01 00:00:00 UTC\"";
///
/// assert_eq!(String::from_utf8(buffer).unwrap(), expected);
/// ```
pub fn dt_to_string_method<S>(dt: &DateTime<Utc>, serializer: S) -> Result<S::Ok, S::Error>
where
Expand All @@ -28,15 +30,16 @@ where
/// # Examples
///
/// ```
/// use serde_json::json;
/// use subscan::utilities::serializers::td_num_seconds_method;
/// use chrono::TimeDelta;
/// use serde_json::Serializer;
///
/// let mut buffer = Vec::new();
/// let mut serializer = Serializer::new(&mut buffer);
///
/// let json = json!({
/// "seconds": TimeDelta::zero().num_seconds(),
/// });
/// let expected = "{\"seconds\":0}";
/// let serialized = td_num_seconds_method(&TimeDelta::zero(), &mut serializer);
///
/// assert_eq!(serde_json::to_string(&json).unwrap(), expected);
/// assert_eq!(String::from_utf8(buffer).unwrap(), "0");
/// ```
pub fn td_num_seconds_method<S>(td: &TimeDelta, serializer: S) -> Result<S::Ok, S::Error>
where
Expand Down

0 comments on commit c286a0b

Please sign in to comment.