From a0e3c53758d526bb418c068bce1c99fa5a597ed3 Mon Sep 17 00:00:00 2001 From: Philipp A Date: Thu, 26 Dec 2019 23:01:00 +0100 Subject: Split into smaller crates --- src/renderer/html_tests.rs | 274 --------------------------------------------- 1 file changed, 274 deletions(-) delete mode 100644 src/renderer/html_tests.rs (limited to 'src/renderer/html_tests.rs') diff --git a/src/renderer/html_tests.rs b/src/renderer/html_tests.rs deleted file mode 100644 index 117b2d4..0000000 --- a/src/renderer/html_tests.rs +++ /dev/null @@ -1,274 +0,0 @@ -use pretty_assertions::assert_eq; - -use crate::parser::parse; -use super::html::render_html; - -fn check_renders_to(rst: &str, expected: &str) { - println!("Rendering:\n{}\n---", rst); - let doc = parse(rst).expect("Cannot parse"); - let mut result_data: Vec = vec![]; - render_html(&doc, &mut result_data, false).expect("Render error"); - let result = String::from_utf8(result_data).expect("Could not decode"); - assert_eq!(result.as_str().trim(), expected); -} - -#[test] -fn test_simple_string() { - check_renders_to( - "Simple String", - "

Simple String

", - ); -} - -#[test] -fn test_simple_string_with_markup() { - check_renders_to( - "Simple String with *emph* and **strong**", - "

Simple String with emph and strong

", - ); -} - -#[test] -fn test_check_inline_literal() { - check_renders_to( - "Simple String with an even simpler ``inline literal``", - "

Simple String with an even simpler inline literal

", - ); -} - -/* -#[test] -fn test_reference_anonymous() { - check_renders_to("\ -A simple `anonymous reference`__ - -__ http://www.test.com/test_url -", "\ -

A simple anonymous reference

\ -"); -} -*/ - -#[test] -fn test_two_paragraphs() { - check_renders_to( - "One paragraph.\n\nTwo paragraphs.", - "

One paragraph.

\n

Two paragraphs.

", - ); -} - -#[test] -fn test_named_reference() { - check_renders_to("\ -A simple `named reference`_ with stuff in between the -reference and the target. - -.. _`named reference`: http://www.test.com/test_url -", "\ -

A simple named reference with stuff in between the \ -reference and the target.

\ -"); -} - -#[test] -fn test_substitution() { - check_renders_to("\ -A |subst|. - -.. |subst| replace:: text substitution -", "

A text substitution.

"); -} - -/* -#[test] -fn test_section_hierarchy() { - check_renders_to("\ -+++++ -Title -+++++ - -Subtitle -======== - -Some stuff - -Section -------- - -Some more stuff - -Another Section -............... - -And even more stuff -", "\ -

Some stuff

-
-

Section

-

Some more stuff

-
-

Another Section

-

And even more stuff

-
-
\ -"); -} - -#[test] -fn test_docinfo_title() { - check_renders_to("\ -+++++ -Title -+++++ - -:author: me - -Some stuff -", "\ -
-

Title

-
-
Author
-

me

-
-

Some stuff

-
\ -"); -} -*/ - -#[test] -fn test_section_hierarchy() { - check_renders_to("\ -+++++ -Title -+++++ - -Not A Subtitle -============== - -Some stuff - -Section -------- - -Some more stuff - -Another Section -............... - -And even more stuff -", "\ -
-

Title

-
-

Not A Subtitle

-

Some stuff

-
-

Section

-

Some more stuff

-
-

Another Section

-

And even more stuff

-
-
-
-
\ -"); -} - -#[test] -fn test_bullet_list() { - check_renders_to("\ -* bullet -* list -", "\ -\ -"); -} - -/* -#[test] -fn test_table() { - check_renders_to("\ -.. table:: - :align: right - - +-----+-----+ - | 1 | 2 | - +-----+-----+ - | 3 | 4 | - +-----+-----+ -", "\ - ---- - - - - - - - - -

1

2

3

4

\ -"); -} -*/ - -/* -#[test] -fn test_field_list() { - check_renders_to("\ -Not a docinfo. - -:This: .. _target: - - is -:a: -:simple: -:field: list -", "\ -

Not a docinfo.

-
-
This
-

is

-
-
a
-

-
simple
-

-
field
-

list

-
-
\ -"); -} -*/ - -/* -#[test] -fn test_field_list_long() { - check_renders_to("\ -Not a docinfo. - -:This is: a -:simple field list with loooong field: names -", "\ -

Not a docinfo.

-
-
This is
-

a

-
-
simple field list with loooong field
-

names

-
-
\ -"); -} -*/ -- cgit v1.2.3