mirror of
https://github.com/nushell/nushell.git
synced 2024-12-02 05:13:56 +01:00
0ee054b14d
* Fix to md errors * Fix variable name and avoid typecasts
74 lines
1.2 KiB
Rust
74 lines
1.2 KiB
Rust
use nu_test_support::{nu, pipeline};
|
|
|
|
#[test]
|
|
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() {
|
|
let actual = nu!(
|
|
cwd: ".", pipeline(
|
|
r#"
|
|
echo 3 | to md
|
|
"#
|
|
));
|
|
|
|
assert_eq!(actual.out, "3");
|
|
}
|
|
|
|
#[test]
|
|
fn md_simple_pretty() {
|
|
let actual = nu!(
|
|
cwd: ".", pipeline(
|
|
r#"
|
|
echo 3 | to md -p
|
|
"#
|
|
));
|
|
|
|
assert_eq!(actual.out, "3");
|
|
}
|
|
|
|
#[test]
|
|
fn md_table() {
|
|
let actual = nu!(
|
|
cwd: ".", pipeline(
|
|
r#"
|
|
echo '{"name": "jason"}' | from json | to md
|
|
"#
|
|
));
|
|
|
|
assert_eq!(actual.out, "|name||-||jason|");
|
|
}
|
|
|
|
#[test]
|
|
fn md_table_pretty() {
|
|
let actual = nu!(
|
|
cwd: ".", pipeline(
|
|
r#"
|
|
echo '{"name": "joseph"}' | from json | to md -p
|
|
"#
|
|
));
|
|
|
|
assert_eq!(actual.out, "| name || ------ || joseph |");
|
|
}
|