2019-12-17 19:54:39 +01:00
|
|
|
use nu_test_support::{nu, pipeline};
|
2019-12-15 17:15:06 +01:00
|
|
|
|
|
|
|
#[test]
|
2020-08-12 09:51:24 +02:00
|
|
|
fn sets_the_column_from_a_block_run_output() {
|
2019-12-15 17:15:06 +01:00
|
|
|
let actual = nu!(
|
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
|
|
|
r#"
|
|
|
|
open cargo_sample.toml
|
|
|
|
| insert dev-dependencies.newdep "1"
|
|
|
|
| get dev-dependencies.newdep
|
|
|
|
| echo $it
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
2020-05-07 13:03:43 +02:00
|
|
|
assert_eq!(actual.out, "1");
|
2019-12-15 17:15:06 +01:00
|
|
|
}
|
2020-07-30 06:58:54 +02:00
|
|
|
|
|
|
|
#[test]
|
2020-08-12 09:51:24 +02:00
|
|
|
fn sets_the_column_from_a_block_full_stream_output() {
|
2020-07-30 06:58:54 +02:00
|
|
|
let actual = nu!(
|
2020-08-12 09:51:24 +02:00
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
2020-07-30 06:58:54 +02:00
|
|
|
r#"
|
2020-08-12 09:51:24 +02:00
|
|
|
wrap _
|
|
|
|
| insert content { open --raw cargo_sample.toml | lines | first 5 }
|
|
|
|
| get content.1
|
|
|
|
| str contains "nu"
|
|
|
|
| echo $it
|
2020-07-30 06:58:54 +02:00
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
2020-08-12 09:51:24 +02:00
|
|
|
assert_eq!(actual.out, "true");
|
2020-07-30 06:58:54 +02:00
|
|
|
}
|
2020-08-26 12:56:45 +02:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn sets_the_column_from_an_invocation() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
|
|
|
r#"
|
|
|
|
wrap content
|
|
|
|
| insert content $(open --raw cargo_sample.toml | lines | first 5)
|
|
|
|
| get content.1
|
|
|
|
| str contains "nu"
|
|
|
|
| echo $it
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "true");
|
|
|
|
}
|