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
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
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"
|
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]
|
2021-06-07 08:08:35 +00:00
|
|
|
fn sets_the_column_from_a_subexpression() {
|
2020-08-26 10:56:45 +00:00
|
|
|
let actual = nu!(
|
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
|
|
|
r#"
|
|
|
|
wrap content
|
2021-05-12 01:01:48 +00:00
|
|
|
| insert content (open --raw cargo_sample.toml | lines | first 5)
|
2020-08-26 10:56:45 +00:00
|
|
|
| get content.1
|
|
|
|
| str contains "nu"
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "true");
|
|
|
|
}
|