mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 12:44:17 +02:00
Clean up tests containing unnecessary cwd:
tokens (#9692)
# 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
This commit is contained in:
committed by
GitHub
parent
48271d8c3e
commit
656f707a0b
@@ -2,8 +2,7 @@ use nu_test_support::{nu, pipeline};
|
||||
|
||||
#[test]
|
||||
fn out_html_simple() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
let actual = nu!(pipeline(
|
||||
r#"
|
||||
echo 3 | to html
|
||||
"#
|
||||
@@ -17,12 +16,9 @@ fn out_html_simple() {
|
||||
|
||||
#[test]
|
||||
fn out_html_partial() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
let actual = nu!(r#"
|
||||
echo 3 | to html -p
|
||||
"#
|
||||
));
|
||||
"#);
|
||||
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
@@ -32,12 +28,9 @@ fn out_html_partial() {
|
||||
|
||||
#[test]
|
||||
fn out_html_table() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
let actual = nu!(r#"
|
||||
echo '{"name": "darren"}' | from json | to html
|
||||
"#
|
||||
));
|
||||
"#);
|
||||
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
@@ -48,13 +41,9 @@ fn out_html_table() {
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_cd_html_color_flag_dark_false() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
let actual = nu!(r#"
|
||||
cd --help | to html --html-color
|
||||
"#
|
||||
)
|
||||
);
|
||||
"#);
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
r"<html><style>body { background-color:white;color:black; }</style><body>Change directory.<br><br><span style='color:green;'>Usage<span style='color:black;font-weight:normal;'>:<br> > cd (path) <br><br></span></span><span style='color:green;'>Flags<span style='color:black;font-weight:normal;'>:<br> </span></span><span style='color:#037979;'>-h</span>,<span style='color:black;font-weight:normal;'> </span><span style='color:#037979;'>--help<span style='color:black;font-weight:normal;'> - Display the help message for this command<br><br></span><span style='color:green;'>Signatures<span style='color:black;font-weight:normal;'>:<br> <nothing> | cd <string?> -> <nothing><br> <string> | cd <string?> -> <nothing><br><br></span></span><span style='color:green;'>Parameters<span style='color:black;font-weight:normal;'>:<br> (optional) </span></span></span><span style='color:#037979;'>path<span style='color:black;font-weight:normal;'> <</span><span style='color:blue;font-weight:bold;'>directory<span style='color:black;font-weight:normal;'>>: the path to change to<br><br></span></span><span style='color:green;'>Examples<span style='color:black;font-weight:normal;'>:<br> Change to your home directory<br> > </span><span style='color:#037979;font-weight:bold;'>cd<span style='color:black;font-weight:normal;'> </span></span></span></span><span style='color:#037979;'>~<span style='color:black;font-weight:normal;'><br><br> Change to a directory via abbreviations<br> > </span><span style='color:#037979;font-weight:bold;'>cd<span style='color:black;font-weight:normal;'> </span></span></span><span style='color:#037979;'>d/s/9<span style='color:black;font-weight:normal;'><br><br> Change to the previous working directory ($OLDPWD)<br> > </span><span style='color:#037979;font-weight:bold;'>cd<span style='color:black;font-weight:normal;'> </span></span></span><span style='color:#037979;'>-<span style='color:black;font-weight:normal;'><br><br></body></html></span></span>"
|
||||
@@ -63,13 +52,9 @@ fn test_cd_html_color_flag_dark_false() {
|
||||
|
||||
#[test]
|
||||
fn test_no_color_flag() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
let actual = nu!(r#"
|
||||
cd --help | to html --no-color
|
||||
"#
|
||||
)
|
||||
);
|
||||
"#);
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
r"<html><style>body { background-color:white;color:black; }</style><body>Change directory.<br><br>Usage:<br> > cd (path) <br><br>Flags:<br> -h, --help - Display the help message for this command<br><br>Signatures:<br> <nothing> | cd <string?> -> <nothing><br> <string> | cd <string?> -> <nothing><br><br>Parameters:<br> path <directory>: the path to change to (optional)<br><br>Examples:<br> Change to your home directory<br> > cd ~<br><br> Change to a directory via abbreviations<br> > cd d/s/9<br><br> Change to the previous working directory ($OLDPWD)<br> > cd -<br><br></body></html>"
|
||||
@@ -78,10 +63,7 @@ fn test_no_color_flag() {
|
||||
|
||||
#[test]
|
||||
fn test_list() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"to html --list | where name == C64 | get 0 | to nuon"#
|
||||
);
|
||||
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"}"##
|
||||
|
Reference in New Issue
Block a user