mirror of
https://github.com/Noratrieb/mono-fmt.git
synced 2026-01-16 16:25:07 +01:00
std
This commit is contained in:
parent
d7844568ca
commit
bfd86b1338
8 changed files with 795 additions and 51 deletions
21
tests/base.rs
Normal file
21
tests/base.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
use mono_fmt::{FmtOpts, Write};
|
||||
|
||||
#[macro_use]
|
||||
extern crate mono_fmt;
|
||||
|
||||
#[test]
|
||||
fn test_format_flags() {
|
||||
// No residual flags left by pointer formatting
|
||||
let p = "".as_ptr();
|
||||
assert_eq!(format!("{:p} {:x}", p, 16), format!("{p:p} 10"));
|
||||
|
||||
assert_eq!(format!("{: >3}", 'a'), " a");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_pointer_formats_data_pointer() {
|
||||
let b: &[u8] = b"";
|
||||
let s: &str = "";
|
||||
assert_eq!(format!("{s:p}"), format!("{:p}", s.as_ptr()));
|
||||
assert_eq!(format!("{b:p}"), format!("{:p}", b.as_ptr()));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue