Debian Codegraph @

src/tests/macros.rs

raw symbols SCIP
1 ///wrap to simulate external use without uses of mod.rs
2 mod macro_test {
3 use crate::FmtError;
4 use crate::{strfmt, strfmt_builder};
5
6 #[test]
7 fn test_macros() -> Result<(), FmtError> {
8 let first = "test";
9 let second = 2;
10 assert_eq!("test", strfmt!("{first}", first)?);
11 assert_eq!("test2", strfmt!("{first}{second}", first, second)?);
12 assert_eq!(
13 "test77.65 ",
14 strfmt!("{first}{third:<7.2}", first,second, third => 77.6543210)?
15 );
16 assert_eq!(
17 "test 77.65",
18 strfmt!("{first}{third:7.2}", first,second, third => 77.6543210)?
19 );
20 Ok(())
21 }
22 }