mirror of
https://github.com/nushell/nushell.git
synced 2024-12-02 05:13:56 +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
92 lines
1.9 KiB
Rust
92 lines
1.9 KiB
Rust
use nu_test_support::{nu, pipeline};
|
|
|
|
#[test]
|
|
fn counter_clockwise() {
|
|
let table = pipeline(
|
|
r#"
|
|
echo [
|
|
[col1, col2, EXPECTED];
|
|
|
|
[---, "|||", XX1]
|
|
[---, "|||", XX2]
|
|
[---, "|||", XX3]
|
|
]
|
|
"#,
|
|
);
|
|
|
|
let expected = nu!(pipeline(
|
|
r#"
|
|
echo [
|
|
[ column0, column1, column2, column3];
|
|
|
|
[ EXPECTED, XX1, XX2, XX3]
|
|
[ col2, "|||", "|||", "|||"]
|
|
[ col1, ---, ---, ---]
|
|
]
|
|
| where column0 == EXPECTED
|
|
| get column1 column2 column3
|
|
| str join "-"
|
|
"#,
|
|
));
|
|
|
|
let actual = nu!(format!(
|
|
"{} | {}",
|
|
table,
|
|
pipeline(
|
|
r#"
|
|
rotate --ccw
|
|
| where column0 == EXPECTED
|
|
| get column1 column2 column3
|
|
| str join "-"
|
|
"#
|
|
)
|
|
));
|
|
|
|
assert_eq!(actual.out, expected.out);
|
|
}
|
|
|
|
#[test]
|
|
fn clockwise() {
|
|
let table = pipeline(
|
|
r#"
|
|
echo [
|
|
[col1, col2, EXPECTED];
|
|
|
|
[ ---, "|||", XX1]
|
|
[ ---, "|||", XX2]
|
|
[ ---, "|||", XX3]
|
|
]
|
|
"#,
|
|
);
|
|
|
|
let expected = nu!(pipeline(
|
|
r#"
|
|
echo [
|
|
[ column0, column1, column2, column3];
|
|
|
|
[ ---, ---, ---, col1]
|
|
[ "|||", "|||", "|||", col2]
|
|
[ XX3, XX2, XX1, EXPECTED]
|
|
]
|
|
| where column3 == EXPECTED
|
|
| get column0 column1 column2
|
|
| str join "-"
|
|
"#,
|
|
));
|
|
|
|
let actual = nu!(format!(
|
|
"{} | {}",
|
|
table,
|
|
pipeline(
|
|
r#"
|
|
rotate
|
|
| where column3 == EXPECTED
|
|
| get column0 column1 column2
|
|
| str join "-"
|
|
"#
|
|
)
|
|
));
|
|
|
|
assert_eq!(actual.out, expected.out);
|
|
}
|