2019-05-01 16:34:24 -04:00
|
|
|
use super::{Context, Module};
|
2020-07-08 06:45:32 +08:00
|
|
|
use crate::segment::Segment;
|
2019-04-04 20:33:36 -04:00
|
|
|
|
2019-07-19 16:18:52 -04:00
|
|
|
/// Creates a module for the line break
|
2019-07-02 16:12:53 -04:00
|
|
|
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
2019-09-09 18:14:38 -05:00
|
|
|
let mut module = context.new_module("line_break");
|
2019-04-12 19:11:40 -04:00
|
|
|
|
2021-09-12 16:59:15 -07:00
|
|
|
module.set_segments(vec![Segment::LineTerm]);
|
2019-05-01 16:34:24 -04:00
|
|
|
|
|
|
|
Some(module)
|
2019-04-04 20:33:36 -04:00
|
|
|
}
|
2020-09-21 19:06:15 +02:00
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod test {
|
|
|
|
use crate::test::ModuleRenderer;
|
|
|
|
|
|
|
|
#[test]
|
2021-02-11 21:08:17 +01:00
|
|
|
fn produces_result() {
|
2020-09-21 19:06:15 +02:00
|
|
|
let expected = Some(String::from("\n"));
|
|
|
|
let actual = ModuleRenderer::new("line_break").collect();
|
|
|
|
assert_eq!(expected, actual);
|
|
|
|
}
|
|
|
|
}
|