#[macro_export]
macro_rules! text {
() => {
$crate::ratatui_core::text::Text::default()
};
($line:expr; $n:expr) => {
$crate::ratatui_core::text::Text::from($crate::vec![$line.into(); $n])
};
($($line:expr),+ $(,)?) => {{
$crate::ratatui_core::text::Text::from($crate::vec![
$(
$line.into(),
)+
])
}};
}
#[cfg(test)]
mod tests {
use alloc::vec;
use ratatui_core::text::Text;
#[test]
fn text() {
let text = text!["hello", "world"];
assert_eq!(text, Text::from(vec!["hello".into(), "world".into()]));
let text = text![crate::line!("hello"), crate::span!["world"]];
assert_eq!(text, Text::from(vec!["hello".into(), "world".into()]));
let text = text!["hello"; 2];
assert_eq!(text, Text::from(vec!["hello".into(), "hello".into()]));
}
}