mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 16:33:37 +01:00
656f707a0b
# Description The working directory doesn't have to be set for those tests (or would be the default anyways). When appropriate also remove calls to the `pipeline()` function. In most places kept the diff minimal and only removed the superfluous part to not pollute the blame view. With simpler tests also simplified things to make them more readable overall (this included removal of the raw string literal). Work for #8670
80 lines
1.4 KiB
Rust
80 lines
1.4 KiB
Rust
use nu_test_support::{nu, pipeline};
|
|
|
|
#[test]
|
|
fn md_empty() {
|
|
let actual = nu!(r#"
|
|
echo [[]; []] | from json | to md
|
|
"#);
|
|
|
|
assert_eq!(actual.out, "");
|
|
}
|
|
|
|
#[test]
|
|
fn md_empty_pretty() {
|
|
let actual = nu!(r#"
|
|
echo "{}" | from json | to md -p
|
|
"#);
|
|
|
|
assert_eq!(actual.out, "");
|
|
}
|
|
|
|
#[test]
|
|
fn md_simple() {
|
|
let actual = nu!(r#"
|
|
echo 3 | to md
|
|
"#);
|
|
|
|
assert_eq!(actual.out, "3");
|
|
}
|
|
|
|
#[test]
|
|
fn md_simple_pretty() {
|
|
let actual = nu!(r#"
|
|
echo 3 | to md -p
|
|
"#);
|
|
|
|
assert_eq!(actual.out, "3");
|
|
}
|
|
|
|
#[test]
|
|
fn md_table() {
|
|
let actual = nu!(r#"
|
|
echo [[name]; [jason]] | to md
|
|
"#);
|
|
|
|
assert_eq!(actual.out, "|name||-||jason|");
|
|
}
|
|
|
|
#[test]
|
|
fn md_table_pretty() {
|
|
let actual = nu!(r#"
|
|
echo [[name]; [joseph]] | to md -p
|
|
"#);
|
|
|
|
assert_eq!(actual.out, "| name || ------ || joseph |");
|
|
}
|
|
|
|
#[test]
|
|
fn md_combined() {
|
|
let actual = nu!(pipeline(
|
|
r#"
|
|
def title [] {
|
|
echo [[H1]; ["Nu top meals"]]
|
|
};
|
|
|
|
def meals [] {
|
|
echo [[dish]; [Arepa] [Taco] [Pizza]]
|
|
};
|
|
|
|
title
|
|
| append (meals)
|
|
| to md --per-element --pretty
|
|
"#
|
|
));
|
|
|
|
assert_eq!(
|
|
actual.out,
|
|
"# Nu top meals| dish || ----- || Arepa || Taco || Pizza |"
|
|
);
|
|
}
|