engine-q merge

This commit is contained in:
Fernando Herrera
2022-02-07 19:11:34 +00:00
1965 changed files with 119062 additions and 20 deletions

View File

@ -1,3 +0,0 @@
mod rows;
mod until;
mod while_;

View File

@ -1,31 +0,0 @@
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::playground::Playground;
use nu_test_support::{nu, pipeline};
#[test]
fn rows() {
Playground::setup("keep_test_1", |dirs, sandbox| {
sandbox.with_files(vec![FileWithContentToBeTrimmed(
"caballeros.csv",
r#"
name,lucky_code
Andrés,1
Jonathan,1
Jason,2
Yehuda,1
"#,
)]);
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
open caballeros.csv
| keep 3
| get lucky_code
| math sum
"#
));
assert_eq!(actual.out, "4");
})
}

View File

@ -10,7 +10,11 @@ fn condition_is_met() {
r#"
CHICKEN SUMMARY report date: April 29th, 2020
--------------------------------------------------------------------
<<<<<<< HEAD
Chicken Collection,29/04/2020,30/04/2020,31/04/2020,
=======
Chicken Collection,29/04/2020,30/04/2020,31/04/2020
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
Yellow Chickens,,,
Andrés,1,1,1
Jonathan,1,1,1
@ -33,6 +37,7 @@ fn condition_is_met() {
cwd: dirs.test(), pipeline(
r#"
open --raw caballeros.txt
<<<<<<< HEAD
| lines
| skip 2
| split column ','
@ -41,6 +46,17 @@ fn condition_is_met() {
| keep until "Chicken Collection" == "Red Chickens"
| skip 1
| str to-int "31/04/2020"
=======
| lines
| skip 2
| str trim
| str collect (char nl)
| from csv
| skip while "Chicken Collection" != "Blue Chickens"
| keep until "Chicken Collection" == "Red Chickens"
| skip 1
| into int "31/04/2020"
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
| get "31/04/2020"
| math sum
"#

View File

@ -10,7 +10,11 @@ fn condition_is_met() {
r#"
CHICKEN SUMMARY report date: April 29th, 2020
--------------------------------------------------------------------
<<<<<<< HEAD
Chicken Collection,29/04/2020,30/04/2020,31/04/2020,
=======
Chicken Collection,29/04/2020,30/04/2020,31/04/2020
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
Yellow Chickens,,,
Andrés,1,1,1
Jonathan,1,1,1
@ -33,6 +37,7 @@ fn condition_is_met() {
cwd: dirs.test(), pipeline(
r#"
open --raw caballeros.txt
<<<<<<< HEAD
| lines
| skip 2
| split column ','
@ -40,6 +45,16 @@ fn condition_is_met() {
| skip 1
| keep while "Chicken Collection" != "Blue Chickens"
| str to-int "31/04/2020"
=======
| lines
| skip 2
| str trim
| str collect (char nl)
| from csv
| skip 1
| keep while "Chicken Collection" != "Blue Chickens"
| into int "31/04/2020"
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
| get "31/04/2020"
| math sum
"#