2020-03-19 20:18:24 +01:00
|
|
|
use nu_test_support::{nu, pipeline};
|
|
|
|
|
|
|
|
#[test]
|
2020-11-06 18:40:53 +01:00
|
|
|
fn md_empty() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
|
|
|
echo "{}" | from json | to md
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn md_empty_pretty() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
|
|
|
echo "{}" | from json | to md -p
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn md_simple() {
|
2020-03-19 20:18:24 +01:00
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
2020-05-04 10:44:33 +02:00
|
|
|
echo 3 | to md
|
2020-03-19 20:18:24 +01:00
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
2020-05-07 13:03:43 +02:00
|
|
|
assert_eq!(actual.out, "3");
|
2020-03-19 20:18:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2020-11-06 18:40:53 +01:00
|
|
|
fn md_simple_pretty() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
|
|
|
echo 3 | to md -p
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "3");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn md_table() {
|
2020-03-19 20:18:24 +01:00
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
2020-05-04 10:44:33 +02:00
|
|
|
echo '{"name": "jason"}' | from json | to md
|
2020-03-19 20:18:24 +01:00
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
2020-05-07 13:03:43 +02:00
|
|
|
assert_eq!(actual.out, "|name||-||jason|");
|
2020-03-19 20:18:24 +01:00
|
|
|
}
|
2020-10-15 05:20:55 +02:00
|
|
|
|
|
|
|
#[test]
|
2020-11-06 18:40:53 +01:00
|
|
|
fn md_table_pretty() {
|
2020-10-15 05:20:55 +02:00
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
|
|
|
echo '{"name": "joseph"}' | from json | to md -p
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
2020-10-19 08:58:24 +02:00
|
|
|
assert_eq!(actual.out, "| name || ------ || joseph |");
|
2020-10-15 05:20:55 +02:00
|
|
|
}
|