extern crate html2md;
use html2md::parse_html;
use pretty_assertions::assert_eq;
#[test]
fn test_list_simple() {
let md = parse_html(r#"
- Seven things has lady Lackless
- Keeps them underneath her black dress
- One a thing that's not for wearing
"#);
assert_eq!(md, "\
* Seven things has lady Lackless
* Keeps them underneath her black dress
* One a thing that's not for wearing")
}
#[test]
fn test_list_formatted() {
// let's use some some broken html
let md = parse_html(r#"
- You should NEVER see this error
- Broken lines, broken strings
- Broken threads, broken springs
- Broken idols, broken heads
- People sleep in broken beds
- Ain't no use jiving
- Ain't no use joking
- EVERYTHING IS BROKEN
"#);
assert_eq!(md, "\
* You should NEVER see this error
* Broken lines, broken strings
* Broken threads, broken springs
* Broken idols, broken heads
* People sleep in broken beds
* Ain't no use jiving
* Ain't no use joking
* EVERYTHING IS BROKEN")
}
#[test]
fn test_list_stackedit() {
let md = parse_html(r#"
"#);
assert_eq!(md, "\
* You should NEVER see this error
* Broken lines, broken strings
* Broken threads, broken springs
* Broken idols, broken heads
* People sleep in broken beds
* Ain’t no use jiving
* Ain’t no use joking
* EVERYTHING IS BROKEN")
}
#[test]
fn test_list_stackedit_add_brs() {
let md = parse_html(r#"
"#);
assert_eq!(md, "\
* You should NEVER see this error
* Broken lines, broken strings
* Broken threads, broken springs
* Broken idols, broken heads
* People sleep in broken beds
* Ain’t no use jiving
* Ain’t no use joking
* EVERYTHING IS BROKEN")
}
#[test]
fn test_list_multiline() {
let md = parse_html(r#"
-
In the heat and the rains
With whips and chains
Just to see him fly
So many die!
"#);
assert_eq!(md, "\
1. In the heat and the rains
With whips and chains
Just to see him fly
So many die!")
}
#[test]
fn test_list_multiline_formatted() {
// let's use some some broken html
let md = parse_html(r#"
- You should NEVER see this error
- Broken lines, broken strings
- Broken threads, broken springs
- Broken idols, broken heads
- People sleep in broken beds
-
Ain't no use jiving
Ain't no use joking
EVERYTHING IS BROKEN
"#);
assert_eq!(md, "\
* You should NEVER see this error
* Broken lines, broken strings
* Broken threads, broken springs
* Broken idols, broken heads
* People sleep in broken beds
* Ain't no use jiving
Ain't no use joking
EVERYTHING IS BROKEN")
}
#[test]
fn test_list_ordered() {
// let's use some some broken html
let md = parse_html(r#"
- Now did you read the news today?
- They say the danger's gone away
- Well I can see the fire still alight
- Burning into the night
"#);
assert_eq!(md, "\
1. Now did you read the news today?
2. They say the danger's gone away
3. Well I can see the fire still alight
4. Burning into the night")
}
#[test]
fn test_list_text_prevsibling() {
let md = parse_html(r#"
Phrases to describe me:
- Awesome
- Cool
- Awesome and cool
- Can count to five
- Learning to count to six B)
"#);
assert_eq!(md, "\
Phrases to describe me:
* Awesome
* Cool
* Awesome and cool
* Can count to five
* Learning to count to six B)")
}