2020-01-10 16:44:24 +01:00
|
|
|
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
|
|
use nu_test_support::playground::Playground;
|
2019-12-17 19:54:39 +01:00
|
|
|
use nu_test_support::{nu, pipeline};
|
2019-12-15 17:15:06 +01:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn adds_a_row_to_the_beginning() {
|
2020-01-10 16:44:24 +01:00
|
|
|
Playground::setup("prepend_test_1", |dirs, sandbox| {
|
|
|
|
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
|
|
|
"los_tres_caballeros.txt",
|
|
|
|
r#"
|
|
|
|
Andrés N. Robalino
|
2023-03-15 06:54:55 +01:00
|
|
|
JT Turner
|
2020-01-10 16:44:24 +01:00
|
|
|
Yehuda Katz
|
|
|
|
"#,
|
|
|
|
)]);
|
2019-12-15 17:15:06 +01:00
|
|
|
|
2020-01-10 16:44:24 +01:00
|
|
|
let actual = nu!(
|
|
|
|
cwd: dirs.test(), pipeline(
|
|
|
|
r#"
|
|
|
|
open los_tres_caballeros.txt
|
|
|
|
| lines
|
|
|
|
| prepend "pollo loco"
|
2022-02-09 11:58:54 +01:00
|
|
|
| get 0
|
2020-01-10 16:44:24 +01:00
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
2020-05-07 13:03:43 +02:00
|
|
|
assert_eq!(actual.out, "pollo loco");
|
2020-01-10 16:44:24 +01:00
|
|
|
})
|
2019-12-15 17:15:06 +01:00
|
|
|
}
|