use crate::html::trim_eq;
#[test]
fn test_header() {
let input = r#"
# Title 1
## Title 2
### Title 3
#### Title 4
##### Title 5
###### Title 6
####### Title 7
# Title **bold**
"#;
let output = r#"
Title 1
Title 2
Title 3
Title 4
Title 5
Title 6
####### Title 7
Titlebold
"#; //TODO: empty p as null
trim_eq(input, output)
}
#[test]
fn test_text() {
let input = r#"
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit anim id est laborum.
"#;
let output = r#"
Loremipsumdolorsitamet,consecteturadipiscingelit,seddoeiusmodtempor
incididuntutlaboreetdoloremagnaaliqua.Utenimadminimveniam,quis
nostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequat.
Duisauteiruredolorinreprehenderitinvoluptatevelitessecillumdolore
eufugiatnullapariatur.Excepteursintoccaecatcupidatatnonproident,sunt
inculpaquiofficiadeseruntmollitanimidestlaborum.
"#;
trim_eq(input, output)
}
#[test]
fn test_style() {
let input = r#"
*斜体 Italic*
**粗体 Bold**
***斜粗体 Bold-Italic***
~下划线 Underline~
~~删除线 Strikethrough~~
~~~数据删除 Undercover~~~
`代码 code`
``code`escape``
"#;
let output = r#"
斜体Italic
粗体Bold
斜粗体Bold-Italic
下划线Underline
删除线Strikethrough
数据删除Undercover
代码code
code`escape
"#;
trim_eq(input, output)
}
#[test]
fn test_math() {
let input = r#"
$x$ $$x^2$$
$$x^2$$ $x$
$$x^2$$ $$x^2$$
$$x^4$$
"#;
let output = r#"
$x$$\displaystyle{x^2}$
$\displaystyle{x^2}$$x$
$\displaystyle{x^2}$$\displaystyle{x^2}$
$$x^4$$
"#;
trim_eq(input, output)
}
#[test]
fn test_function() {
let input = r#"
\title: Test
\date: 2018-01-08
\netease[song][22724727]
\netease{"song", 28629058, autoplay = true}
\link[https://github.com/nyar-lang/notedown-rs]
"#;
let output = r#"
https://github.com/nyar-lang/notedown-rs
"#;
trim_eq(input, output)
}
#[test]
fn test_table() {
let input = r#"
|name | age | level
:-|-:
aster | 17
"#;
let output = r#"
"#;
trim_eq(input, output)
}
#[test]
#[cfg(not(feature = "desktop"))]
fn test_code() {
let input = r#"
```js
let r = 0
```
"#;
let output = r#"
\js[]{"body": "\n let r = 0\n "}
"#;
trim_eq(input, output);
}
#[test]
fn test_quote() {
let input = r#"
> - 1
> 2
> - 3
"#;
let output = r#"
"#;
trim_eq(input, output)
}
#[test]
fn test_escaping() {
let input = r#"
\\
"#;
let output = r#"
\
"#;
trim_eq(input, output)
}
#[test]
fn test_url() {
let input = r#"
https://www.zhihu.com/question/311834230/answer/595009063
http://mathworld.wolfram.com/PrimeFormulas.html
Page210
http://read.pudn.com/downloads133/ebook/566944/%E9%AB%98%E6%95%88%E7%A8%8B%E5%BA%8F%E7%9A%84%E5%A5%A5%E7%A7%98.pdf
ftp://www.m-hikari.com/ams/ams-2012/ams-73-76-2012/kaddouraAMS73-76-2012.pdf
"#;
let output = r#"
https://www.zhihu.com/question/311834230/answer/595009063
http://mathworld.wolfram.com/PrimeFormulas.html
Page210
http://read.pudn.com/downloads133/ebook/566944/高效程序的奥秘.pdf
ftp://www.m-hikari.com/ams/ams-2012/ams-73-76-2012/kaddouraAMS73-76-2012.pdf
"#;
trim_eq(input, output)
}