debug fmt

This commit is contained in:
nora 2022-09-12 08:12:29 +02:00
parent 86441cf10b
commit 1152f8ab99
2 changed files with 58 additions and 15 deletions

View file

@ -1,3 +1,7 @@
// for the test macro expansion
#[cfg(test)]
extern crate self as mono_fmt;
pub use mono_fmt_macro::format_args;
use std::fmt::{Error, Write};
@ -136,8 +140,6 @@ macro_rules! format {
#[cfg(test)]
mod tests {
// for the macros
use crate as mono_fmt;
use crate::format;
@ -152,4 +154,17 @@ mod tests {
let result = format!("{}", "uwu");
assert_eq!(result, "uwu");
}
#[test]
fn display_with_strings() {
let result = format!("oow{} omg", "uwu");
assert_eq!(result, "oowuwu omg");
}
#[test]
fn debug() {
let result = format!("test {:?} hello", "uwu");
assert_eq!(result, r#"test "uwu" hello"#);
}
}