extern crate doccy;
use doccy::doccy_to_html;
#[test]
fn empty_document() {
let result = doccy_to_html(r#""#);
assert_eq!(result, Ok("".to_string()));
}
#[test]
fn wrap_text_with_paragraphs() {
let result = doccy_to_html(r#"foobar"#);
assert_eq!(result, Ok("<p>foobar</p>".to_string()));
}
#[test]
fn wrap_text_with_paragraphs_in_block_element() {
let result = doccy_to_html(r#"{div: foobar}"#);
assert_eq!(result, Ok("<div><p>foobar</p></div>".to_string()));
}
#[test]
fn error_on_unescaped_element() {
let result = doccy_to_html(r#"{div: }}"#);
assert!(result.is_err());
}
#[test]
fn error_on_invalid_identifier() {
let result = doccy_to_html(r#"{_:}"#);
assert!(result.is_err());
}
#[test]
fn error_on_unescaped_data_attribute() {
let result = doccy_to_html(r#"{div %foobar %:}"#);
assert!(result.is_err());
}
#[test]
fn error_on_unescaped_named_attribute() {
let result = doccy_to_html(r#"{div @foobar @:}"#);
assert!(result.is_err());
}
#[test]
fn self_closing_syntax_on_contentless_element() {
let result = doccy_to_html(r#"{div}"#);
assert_eq!(result, Ok("<div></div>".to_string()));
}