Skip to content

Commit

Permalink
Format.
Browse files Browse the repository at this point in the history
  • Loading branch information
ISibboI committed Aug 5, 2023
1 parent eaeca43 commit 170b1cb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/level_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl LevelStack {

/// Collapse the stack down to the root section and return it.
/// The root section contains the whole section hierarchy added to the stack.
///
///
/// If there is more than one root section, then only the first is returned.
pub fn into_root_section(mut self) -> Section {
self.adjust_level(1);
Expand Down
40 changes: 24 additions & 16 deletions src/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::wikitext::{Headline, Line, Paragraph};
use crate::{
parse_wikitext, ParserErrorKind, Section, Text, TextFormatting, TextPiece, TextPosition, Wikitext,
parse_wikitext, ParserErrorKind, Section, Text, TextFormatting, TextPiece, TextPosition,
Wikitext,
};

mod full_pages;
Expand Down Expand Up @@ -225,22 +226,29 @@ fn test_multiple_root_sections() {
assert_eq!(
errors,
vec![
ParserErrorKind::SecondRootSection { label: "a".to_string() }.into_parser_error(TextPosition {
line: 1,
column: 1,
}),
ParserErrorKind::SecondRootSection { label: "b".to_string() }.into_parser_error(TextPosition {
line: 3,
column: 1,
}),
ParserErrorKind::SecondRootSection { label: "c".to_string() }.into_parser_error(TextPosition {
line: 5,
column: 1,
}),
ParserErrorKind::SecondRootSection {
label: "a".to_string()
}
.into_parser_error(TextPosition { line: 1, column: 1 }),
ParserErrorKind::SecondRootSection {
label: "b".to_string()
}
.into_parser_error(TextPosition { line: 3, column: 1 }),
ParserErrorKind::SecondRootSection {
label: "c".to_string()
}
.into_parser_error(TextPosition { line: 5, column: 1 }),
]
);

assert_eq!(parsed, Wikitext {
root_section: Section { headline: Headline::new("", 1), paragraphs: Vec::new(), subsections: Vec::new() },
});
assert_eq!(
parsed,
Wikitext {
root_section: Section {
headline: Headline::new("", 1),
paragraphs: Vec::new(),
subsections: Vec::new()
},
}
);
}

0 comments on commit 170b1cb

Please sign in to comment.