2020-08-02 09:29:29 +02:00
|
|
|
use nu_test_support::{nu, pipeline};
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_1() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2020-08-02 09:29:29 +02:00
|
|
|
r#"
|
2022-09-11 10:48:27 +02:00
|
|
|
echo 1..5 | into string | str join
|
2020-08-02 09:29:29 +02:00
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
2020-08-02 09:29:29 +02:00
|
|
|
|
|
|
|
assert_eq!(actual.out, "12345");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_2() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2020-08-02 09:29:29 +02:00
|
|
|
r#"
|
2022-09-11 10:48:27 +02:00
|
|
|
echo [a b c d] | str join "<sep>"
|
2020-08-02 09:29:29 +02:00
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
2020-08-02 09:29:29 +02:00
|
|
|
|
|
|
|
assert_eq!(actual.out, "a<sep>b<sep>c<sep>d");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn construct_a_path() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2020-08-02 09:29:29 +02:00
|
|
|
r#"
|
2022-09-11 10:48:27 +02:00
|
|
|
echo [sample txt] | str join "."
|
2020-08-02 09:29:29 +02:00
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
2020-08-02 09:29:29 +02:00
|
|
|
|
|
|
|
assert_eq!(actual.out, "sample.txt");
|
|
|
|
}
|