use nu_test_support::{nu, pipeline};
#[test]
fn out_html_simple() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo 3 | to html
"#
));
assert_eq!(
actual.out,
r"
3"
);
}
#[test]
fn out_html_partial() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo 3 | to html -p
"#
));
assert_eq!(
actual.out,
"3
"
);
}
#[test]
fn out_html_table() {
let actual = nu!(
cwd: ".", pipeline(
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!(
cwd: ".", pipeline(
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
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]
fn test_no_color_flag() {
let actual = nu!(
cwd: ".", pipeline(
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
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]
fn test_list() {
let actual = nu!(
cwd: ".",
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"}"##
);
}