use nu_test_support::{nu, pipeline};
#[test]
fn out_html_simple() {
let actual = nu!(pipeline(
r#"
echo 3 | to html
"#
));
assert_eq!(
actual.out,
r"
3"
);
}
#[test]
fn out_html_partial() {
let actual = nu!(r#"
echo 3 | to html -p
"#);
assert_eq!(
actual.out,
"3
"
);
}
#[test]
fn out_html_table() {
let actual = nu!(r#"
echo '{"name": "darren"}' | from json | to html
"#);
assert_eq!(
actual.out,
r""
);
}
#[test]
#[ignore]
fn test_cd_html_color_flag_dark_false() {
let actual = nu!(r#"
cd --help | to html --html-color
"#);
assert_eq!(
actual.out,
r"Change directory.
Usage:
> cd (path)
Flags:
-h, --help - Display the help message for this command
Signatures:
<nothing> | cd <string?> -> <nothing>
<string> | cd <string?> -> <nothing>
Parameters:
(optional) path <directory>: the path to change to
Examples:
Change to your home directory
> cd ~
Change to a directory via abbreviations
> cd d/s/9
Change to the previous working directory ($OLDPWD)
> cd -
"
);
}
#[test]
#[ignore]
fn test_no_color_flag() {
// TODO replace with something potentially more stable, otherwise this test needs to be
// manuallly updated when ever the help output changes
let actual = nu!(r#"
cd --help | to html --no-color
"#);
assert_eq!(
actual.out,
r"Change directory.
Usage:
> cd (path)
Flags:
-h, --help - Display the help message for this command
Parameters:
path <directory>: The path to change to. (optional)
Input/output types:
╭─#─┬──input──┬─output──╮
│ 0 │ nothing │ nothing │
│ 1 │ string │ nothing │
╰───┴─────────┴─────────╯
Examples:
Change to your home directory
> cd ~
Change to the previous working directory ($OLDPWD)
> cd -
"
)
}
#[test]
fn test_list() {
let actual = nu!(r#"to html --list | where name == C64 | get 0 | to nuon"#);
assert_eq!(
actual.out,
r##"{name: "C64", black: "#090300", red: "#883932", green: "#55a049", yellow: "#bfce72", blue: "#40318d", purple: "#8b3f96", cyan: "#67b6bd", white: "#ffffff", brightBlack: "#000000", brightRed: "#883932", brightGreen: "#55a049", brightYellow: "#bfce72", brightBlue: "#40318d", brightPurple: "#8b3f96", brightCyan: "#67b6bd", brightWhite: "#f7f7f7", background: "#40318d", foreground: "#7869c4"}"##
);
}