Add basic test for plain list item.
This commit is contained in:
parent
422535fbe4
commit
fc9d131740
@ -20,11 +20,17 @@ use crate::parser::util::start_of_line;
|
|||||||
use super::error::CustomError;
|
use super::error::CustomError;
|
||||||
use super::error::MyError;
|
use super::error::MyError;
|
||||||
use super::error::Res;
|
use super::error::Res;
|
||||||
|
use super::greater_element::PlainList;
|
||||||
use super::greater_element::PlainListItem;
|
use super::greater_element::PlainListItem;
|
||||||
use super::parser_with_context::parser_with_context;
|
use super::parser_with_context::parser_with_context;
|
||||||
use super::util::non_whitespace_character;
|
use super::util::non_whitespace_character;
|
||||||
use super::Context;
|
use super::Context;
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub fn plain_list<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, PlainList<'s>> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn plain_list_item<'r, 's>(
|
pub fn plain_list_item<'r, 's>(
|
||||||
context: Context<'r, 's>,
|
context: Context<'r, 's>,
|
||||||
@ -105,3 +111,24 @@ fn get_context_item_indent<'r, 's>(context: Context<'r, 's>) -> Option<&'r usize
|
|||||||
}
|
}
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use crate::parser::parser_context::ContextElement;
|
||||||
|
use crate::parser::parser_context::ContextTree;
|
||||||
|
use crate::parser::parser_with_context::parser_with_context;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn plain_list_item_empty() {
|
||||||
|
let input = "1.";
|
||||||
|
let initial_context: ContextTree<'_, '_> = ContextTree::new();
|
||||||
|
let document_context =
|
||||||
|
initial_context.with_additional_node(ContextElement::DocumentRoot(input));
|
||||||
|
let plain_list_item_matcher = parser_with_context!(plain_list_item)(&document_context);
|
||||||
|
let (remaining, result) = plain_list_item_matcher(input).unwrap();
|
||||||
|
assert_eq!(remaining, "");
|
||||||
|
assert_eq!(result.source, "1.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user