2020-03-15 03:04:44 +00:00
|
|
|
use nu_test_support::{nu, pipeline};
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn out_html_simple() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
2020-05-04 08:44:33 +00:00
|
|
|
echo 3 | to html
|
2020-03-15 03:04:44 +00:00
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
2020-05-07 11:03:43 +00:00
|
|
|
assert_eq!(actual.out, "<html><body>3</body></html>");
|
2020-03-15 03:04:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn out_html_table() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
2020-05-04 08:44:33 +00:00
|
|
|
echo '{"name": "jason"}' | from json | to html
|
2020-03-15 03:04:44 +00:00
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(
|
2020-05-07 11:03:43 +00:00
|
|
|
actual.out,
|
2020-03-15 03:04:44 +00:00
|
|
|
"<html><body><table><tr><th>name</th></tr><tr><td>jason</td></tr></table></body></html>"
|
|
|
|
);
|
|
|
|
}
|