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]
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 to a new path.
Usage:
> cd (directory) {flags}
Parameters:
(directory) the directory to change to
Flags:
-h, --help: Display this help message
Examples:
Change to a new directory called 'dirname'
> cd dirname
Change to your home directory
> cd
Change to your home directory (alternate version)
> cd ~
Change to the previous directory
> 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 to a new path.
Usage:
> cd (directory) {flags}
Parameters:
(directory) the directory to change to
Flags:
-h, --help: Display this help message
Examples:
Change to a new directory called 'dirname'
> cd dirname
Change to your home directory
> cd
Change to your home directory (alternate version)
> cd ~
Change to the previous directory
> cd -
"
);
}
#[test]
fn test_html_color_where_flag_dark_false() {
let actual = nu!(
cwd: ".", pipeline(
r#"
where --help | to html --html_color
"#
)
);
assert_eq!(
actual.out,
r"Filter table to match the condition.
Usage:
> where <condition> {flags}
Parameters:
<condition> the condition that must match
Flags:
-h, --help: Display this help message
Examples:
List all files in the current directory with sizes greater than 2kb
> ls | where size > 2kb
List only the files in the current directory
> ls | where type == File
List all files with names that contain "Car"
> ls | where name =~ "Car"
List all files that were modified in the last two months
> ls | where modified <= 2mon
"
);
}