2019-12-17 18:54:39 +00:00
|
|
|
use nu_test_support::{nu, pipeline};
|
2019-12-15 16:15:06 +00:00
|
|
|
|
|
|
|
#[test]
|
2020-08-12 07:51:24 +00:00
|
|
|
fn sets_the_column_from_a_block_run_output() {
|
2019-12-15 16:15:06 +00: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 11:03:43 +00:00
|
|
|
assert_eq!(actual.out, "1");
|
2019-12-15 16:15:06 +00:00
|
|
|
}
|
2020-07-30 04:58:54 +00:00
|
|
|
|
|
|
|
#[test]
|
2020-08-12 07:51:24 +00:00
|
|
|
fn sets_the_column_from_a_block_full_stream_output() {
|
2020-07-30 04:58:54 +00:00
|
|
|
let actual = nu!(
|
2020-08-12 07:51:24 +00:00
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
2020-07-30 04:58:54 +00:00
|
|
|
r#"
|
2020-08-12 07:51:24 +00:00
|
|
|
wrap _
|
|
|
|
| insert content { open --raw cargo_sample.toml | lines | first 5 }
|
|
|
|
| get content.1
|
|
|
|
| str contains "nu"
|
|
|
|
| echo $it
|
2020-07-30 04:58:54 +00:00
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
2020-08-12 07:51:24 +00:00
|
|
|
assert_eq!(actual.out, "true");
|
2020-07-30 04:58:54 +00:00
|
|
|
}
|
2020-08-26 10:56:45 +00: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");
|
|
|
|
}
|