nushell/crates/nu-cli/tests/format_conversions/markdown.rs
Joseph T. Lyons 2fd464bf7b
Refactor to md and Add Padding for Pretty Flag (#2678)
* refactor and cleanup to md

* Add padding around values in each row

* Add padding to test

* Update code to satisfy Clippy and pass other failing tests
2020-10-19 19:58:24 +13:00

38 lines
672 B
Rust

use nu_test_support::{nu, pipeline};
#[test]
fn out_md_simple() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo 3 | to md
"#
));
assert_eq!(actual.out, "3");
}
#[test]
fn out_md_table() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo '{"name": "jason"}' | from json | to md
"#
));
assert_eq!(actual.out, "|name||-||jason|");
}
#[test]
fn out_md_table_pretty() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo '{"name": "joseph"}' | from json | to md -p
"#
));
assert_eq!(actual.out, "| name || ------ || joseph |");
}