use alloc::string::ToString;
use crate::error::Result;
use crate::parser::parse;
use crate::tests::ex;
const DISPLAY_STABLE: &[(&str, u32, &str)] = &[
ex!("2020, 2021 10:00-16:00"),
];
const DISPLAY_MODIFIED: &[(&str, u32, &str, &str)] = &[
ex!("2020, 10:00-16:00", "2020, Mo-Su 10:00-16:00"),
];
#[test]
fn display_stable() -> Result<()> {
for (file, line, example) in DISPLAY_STABLE {
assert_eq!(
parse(example)?.to_string(),
*example,
"example should be displayed like parsed expression at {file}:{line}",
);
}
Ok(())
}
#[test]
fn display_modified() -> Result<()> {
for (file, line, example, expected) in DISPLAY_MODIFIED {
assert_eq!(
parse(example)?.to_string(),
*expected,
"unexpected stringified expression at {file}:{line}",
);
}
Ok(())
}