forked from VOICEVOX/voicevox_core
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
64 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
/// cbindgen:ignore | ||
mod engine; | ||
mod error; | ||
mod macros; | ||
mod numerics; | ||
mod publish; | ||
mod result; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#[cfg(test)] | ||
pub(crate) mod tests { | ||
use std::fmt::{self, Debug}; | ||
|
||
use pretty_assertions::StrComparison; | ||
|
||
/// 2つの`"{:#?}"`が等しいかを、pretty\_assertions風にassertする。 | ||
/// | ||
/// `io::Error`や`anyhow::Error`を抱えていて`PartialEq`実装が難しい型に使う。 | ||
/// | ||
/// # Panics | ||
/// | ||
/// 2つの`"{:#?}"`が等しくないとき、assertの失敗としてパニックする。 | ||
macro_rules! assert_debug_fmt_eq { | ||
($left:expr, $right:expr $(,)?) => {{ | ||
crate::macros::tests::__assert_debug_fmt(&$left, &$right, None) | ||
}}; | ||
($left:expr, $right:expr, $($arg:tt)*) => {{ | ||
crate::macros::tests::__assert_debug_fmt(&$left, &$right, Some(format_args!($($arg)*))) | ||
}}; | ||
} | ||
pub(crate) use assert_debug_fmt_eq; | ||
|
||
#[track_caller] | ||
pub(crate) fn __assert_debug_fmt<T: Debug>( | ||
left: &T, | ||
right: &T, | ||
args: Option<fmt::Arguments<'_>>, | ||
) { | ||
let (left, right) = (format!("{left:#?}"), format!("{right:#?}")); | ||
if left != right { | ||
panic!( | ||
r#"assertion failed: `("{{left:#?}}" == "{{right:#?}}")`{} | ||
{} | ||
"#, | ||
match args { | ||
Some(args) => format!(": {args}"), | ||
None => "".to_owned(), | ||
}, | ||
StrComparison::new(&left, &right), | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters