use super::*;
#[test]
fn test_paragraph_at_root_crash() {
let options = Options {
..Default::default()
};
let arena = Arena::new();
let para = parse_document(&arena, "para", &options)
.first_child()
.unwrap();
para.detach();
let mut output = String::new();
html::format_document(para, &options, &mut output).unwrap();
}
#[test]
fn test_empty_table_crash() {
let options = Options {
extension: options::Extension {
table: true,
..Default::default()
},
..Default::default()
};
let arena = Arena::new();
let table = parse_document(&arena, "| x |\n| - |\n| z |", &options)
.first_child()
.unwrap();
while let Some(child) = table.first_child() {
child.detach();
}
let mut output = String::new();
html::format_document(table, &options, &mut output).unwrap();
}
#[test]
#[should_panic(expected = "rendered a table cell without a containing table")]
fn test_table_cell_out_of_water_crash() {
let options = Options {
extension: options::Extension {
table: true,
..Default::default()
},
..Default::default()
};
let arena = Arena::new();
let doc = parse_document(&arena, "| x |\n| - |\n| z |", &options);
let table_row = doc
.first_child() .unwrap()
.last_child() .unwrap();
let table_cell = table_row
.first_child() .unwrap();
table_row.detach();
let mut output = String::new();
html::format_document(table_cell, &options, &mut output).unwrap();
}
#[test]
#[should_panic(expected = "rendered a table cell without a containing table row")]
fn test_table_cell_out_of_school_crash() {
let options = Options {
extension: options::Extension {
table: true,
..Default::default()
},
..Default::default()
};
let arena = Arena::new();
let doc = parse_document(&arena, "| x |\n| - |\n| z |", &options);
let table_row = doc
.first_child() .unwrap()
.last_child() .unwrap();
let table_cell = table_row
.first_child() .unwrap();
table_cell.detach();
let mut output = String::new();
html::format_document(table_cell, &options, &mut output).unwrap();
}