forked from extern/nushell
Remove file I/O from tests that don't need it (#11182)
# Description This PR implements modifications to command tests that write unnecessary json and csv to disk then load it with open, by using nuon literals instead. - Fixes #7189 # User-Facing Changes None # Tests + Formatting This only affects existing tests, which still pass.
This commit is contained in:
parent
d08e254d16
commit
54d73748e4
@ -1,13 +1,8 @@
|
|||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
||||||
use nu_test_support::playground::Playground;
|
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn discards_rows_where_given_column_is_empty() {
|
fn discards_rows_where_given_column_is_empty() {
|
||||||
Playground::setup("compact_test_1", |dirs, sandbox| {
|
let sample_json = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
|
||||||
"los_tres_amigos.json",
|
|
||||||
r#"
|
|
||||||
{
|
{
|
||||||
"amigos": [
|
"amigos": [
|
||||||
{"name": "Yehuda", "rusty_luck": 1},
|
{"name": "Yehuda", "rusty_luck": 1},
|
||||||
@ -16,27 +11,22 @@ fn discards_rows_where_given_column_is_empty() {
|
|||||||
{"name":"GorbyPuff"}
|
{"name":"GorbyPuff"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
"#,
|
"#;
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
"
|
"
|
||||||
open los_tres_amigos.json
|
{sample_json}
|
||||||
| get amigos
|
| get amigos
|
||||||
| compact rusty_luck
|
| compact rusty_luck
|
||||||
| length
|
| length
|
||||||
"
|
"
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "3");
|
assert_eq!(actual.out, "3");
|
||||||
});
|
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn discards_empty_rows_by_default() {
|
fn discards_empty_rows_by_default() {
|
||||||
Playground::setup("compact_test_2", |dirs, _| {
|
let actual = nu!(pipeline(
|
||||||
let actual = nu!(
|
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
r#"
|
||||||
echo "[1,2,3,14,null]"
|
echo "[1,2,3,14,null]"
|
||||||
| from json
|
| from json
|
||||||
@ -46,5 +36,4 @@ fn discards_empty_rows_by_default() {
|
|||||||
));
|
));
|
||||||
|
|
||||||
assert_eq!(actual.out, "4");
|
assert_eq!(actual.out, "4");
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
||||||
use nu_test_support::playground::Playground;
|
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn adds_row_data_if_column_missing() {
|
fn adds_row_data_if_column_missing() {
|
||||||
Playground::setup("default_test_1", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
|
||||||
"los_tres_amigos.json",
|
|
||||||
r#"
|
|
||||||
{
|
{
|
||||||
"amigos": [
|
"amigos": [
|
||||||
{"name": "Yehuda"},
|
{"name": "Yehuda"},
|
||||||
@ -16,22 +11,19 @@ fn adds_row_data_if_column_missing() {
|
|||||||
{"name":"GorbyPuff"}
|
{"name":"GorbyPuff"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
"#,
|
"#;
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
"
|
"
|
||||||
open los_tres_amigos.json
|
{sample}
|
||||||
| get amigos
|
| get amigos
|
||||||
| default 1 rusty_luck
|
| default 1 rusty_luck
|
||||||
| where rusty_luck == 1
|
| where rusty_luck == 1
|
||||||
| length
|
| length
|
||||||
"
|
"
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "2");
|
assert_eq!(actual.out, "2");
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
||||||
use nu_test_support::playground::Playground;
|
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -43,10 +41,7 @@ fn flatten_nested_tables() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn flatten_row_column_explicitly() {
|
fn flatten_row_column_explicitly() {
|
||||||
Playground::setup("flatten_test_1", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
|
||||||
"katz.json",
|
|
||||||
r#"
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"people": {
|
"people": {
|
||||||
@ -61,24 +56,18 @@ fn flatten_row_column_explicitly() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
"#,
|
"#;
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(),
|
"{sample} | flatten people --all | where name == Andres | length"
|
||||||
"open katz.json | flatten people --all | where name == Andres | length"
|
)));
|
||||||
);
|
|
||||||
|
|
||||||
assert_eq!(actual.out, "1");
|
assert_eq!(actual.out, "1");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn flatten_row_columns_having_same_column_names_flats_separately() {
|
fn flatten_row_columns_having_same_column_names_flats_separately() {
|
||||||
Playground::setup("flatten_test_2", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
|
||||||
"katz.json",
|
|
||||||
r#"
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"people": {
|
"people": {
|
||||||
@ -95,24 +84,18 @@ fn flatten_row_columns_having_same_column_names_flats_separately() {
|
|||||||
"city": [{"name": "Oregon"}, {"name": "Brooklin"}]
|
"city": [{"name": "Oregon"}, {"name": "Brooklin"}]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
"#,
|
"#;
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(),
|
"{sample} | flatten --all | flatten people city | get city_name | length"
|
||||||
"open katz.json | flatten --all | flatten people city | get city_name | length"
|
)));
|
||||||
);
|
|
||||||
|
|
||||||
assert_eq!(actual.out, "4");
|
assert_eq!(actual.out, "4");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn flatten_table_columns_explicitly() {
|
fn flatten_table_columns_explicitly() {
|
||||||
Playground::setup("flatten_test_3", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
|
||||||
"katz.json",
|
|
||||||
r#"
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"people": {
|
"people": {
|
||||||
@ -129,24 +112,18 @@ fn flatten_table_columns_explicitly() {
|
|||||||
"city": ["Oregon", "Brooklin"]
|
"city": ["Oregon", "Brooklin"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
"#,
|
"#;
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(),
|
"{sample} | flatten city --all | where people.name == Katz | length",
|
||||||
"open katz.json | flatten city --all | where people.name == Katz | length"
|
)));
|
||||||
);
|
|
||||||
|
|
||||||
assert_eq!(actual.out, "2");
|
assert_eq!(actual.out, "2");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn flatten_more_than_one_column_that_are_subtables_not_supported() {
|
fn flatten_more_than_one_column_that_are_subtables_not_supported() {
|
||||||
Playground::setup("flatten_test_4", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
|
||||||
"katz.json",
|
|
||||||
r#"
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"people": {
|
"people": {
|
||||||
@ -165,15 +142,10 @@ fn flatten_more_than_one_column_that_are_subtables_not_supported() {
|
|||||||
"city": ["Oregon", "Brooklin"]
|
"city": ["Oregon", "Brooklin"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
"#,
|
"#;
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!("{sample} | flatten tags city --all")));
|
||||||
cwd: dirs.test(),
|
|
||||||
"open katz.json | flatten tags city --all"
|
|
||||||
);
|
|
||||||
|
|
||||||
assert!(actual.err.contains("tried flattening"));
|
assert!(actual.err.contains("tried flattening"));
|
||||||
assert!(actual.err.contains("but is flattened already"));
|
assert!(actual.err.contains("but is flattened already"));
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
@ -1,40 +1,29 @@
|
|||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
||||||
use nu_test_support::playground::Playground;
|
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn groups() {
|
fn groups() {
|
||||||
Playground::setup("group_by_test_1", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[[first_name, last_name, rusty_at, type];
|
||||||
"los_tres_caballeros.csv",
|
[Andrés, Robalino, "10/11/2013", A],
|
||||||
r#"
|
[JT, Turner, "10/12/2013", B],
|
||||||
first_name,last_name,rusty_at,type
|
[Yehuda, Katz, "10/11/2013", A]]
|
||||||
Andrés,Robalino,10/11/2013,A
|
"#;
|
||||||
JT,Turner,10/12/2013,B
|
|
||||||
Yehuda,Katz,10/11/2013,A
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
r#"
|
||||||
open los_tres_caballeros.csv
|
{sample}
|
||||||
| group-by rusty_at
|
| group-by rusty_at
|
||||||
| get "10/11/2013"
|
| get "10/11/2013"
|
||||||
| length
|
| length
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "2");
|
assert_eq!(actual.out, "2");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn errors_if_given_unknown_column_name() {
|
fn errors_if_given_unknown_column_name() {
|
||||||
Playground::setup("group_by_test_2", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
|
||||||
"los_tres_caballeros.json",
|
|
||||||
r#"
|
|
||||||
{
|
{
|
||||||
"nu": {
|
"nu": {
|
||||||
"committers": [
|
"committers": [
|
||||||
@ -54,46 +43,33 @@ fn errors_if_given_unknown_column_name() {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"#,
|
"#;
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
r#"
|
||||||
open los_tres_caballeros.json
|
'{sample}'
|
||||||
| group-by {|| get nu.releases.version }
|
| from json
|
||||||
|
| group-by {{|| get nu.releases.version }}
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert!(actual
|
assert!(actual
|
||||||
.err
|
.err
|
||||||
.contains("requires a table with one value for grouping"));
|
.contains("requires a table with one value for grouping"));
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn errors_if_column_not_found() {
|
fn errors_if_column_not_found() {
|
||||||
Playground::setup("group_by_test_3", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[[first_name, last_name, rusty_at, type];
|
||||||
"los_tres_caballeros.csv",
|
[Andrés, Robalino, "10/11/2013", A],
|
||||||
r#"
|
[JT, Turner, "10/12/2013", B],
|
||||||
first_name,last_name,rusty_at,type
|
[Yehuda, Katz, "10/11/2013", A]]
|
||||||
Andrés,Robalino,10/11/2013,A
|
"#;
|
||||||
JT,Turner,10/12/2013,B
|
|
||||||
Yehuda,Katz,10/11/2013,A
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!("{sample} | group-by ttype")));
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
"
|
|
||||||
open los_tres_caballeros.csv
|
|
||||||
| group-by ttype
|
|
||||||
"
|
|
||||||
));
|
|
||||||
|
|
||||||
assert!(actual.err.contains("did you mean 'type'"),);
|
assert!(actual.err.contains("did you mean 'type'"),);
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,95 +1,61 @@
|
|||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
||||||
use nu_test_support::playground::Playground;
|
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
|
const SAMPLE_INPUT: &str = r#"
|
||||||
|
[[first_name, last_name, rusty_at];
|
||||||
|
[Andrés, Robalino, Ecuador],
|
||||||
|
[JT, Turner, "Estados Unidos"],
|
||||||
|
[Yehuda, Katz, "Estados Unidos"]]
|
||||||
|
"#;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn summarizes_by_column_given() {
|
fn summarizes_by_column_given() {
|
||||||
Playground::setup("histogram_test_1", |dirs, sandbox| {
|
let actual = nu!(pipeline(&format!(
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
|
||||||
"los_tres_caballeros.csv",
|
|
||||||
r#"
|
r#"
|
||||||
first_name,last_name,rusty_at
|
{SAMPLE_INPUT}
|
||||||
Andrés,Robalino,Ecuador
|
|
||||||
JT,Turner,Estados Unidos
|
|
||||||
Yehuda,Katz,Estados Unidos
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
|
||||||
open los_tres_caballeros.csv
|
|
||||||
| histogram rusty_at countries --percentage-type relative
|
| histogram rusty_at countries --percentage-type relative
|
||||||
| where rusty_at == "Ecuador"
|
| where rusty_at == "Ecuador"
|
||||||
| get countries
|
| get countries
|
||||||
| get 0
|
| get 0
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
actual.out,
|
actual.out,
|
||||||
"**************************************************"
|
"**************************************************"
|
||||||
);
|
);
|
||||||
// 50%
|
// 50%
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn summarizes_by_column_given_with_normalize_percentage() {
|
fn summarizes_by_column_given_with_normalize_percentage() {
|
||||||
Playground::setup("histogram_test_1", |dirs, sandbox| {
|
let actual = nu!(pipeline(&format!(
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
|
||||||
"los_tres_caballeros.csv",
|
|
||||||
r#"
|
r#"
|
||||||
first_name,last_name,rusty_at
|
{SAMPLE_INPUT}
|
||||||
Andrés,Robalino,Ecuador
|
|
||||||
JT,Turner,Estados Unidos
|
|
||||||
Yehuda,Katz,Estados Unidos
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
|
||||||
open los_tres_caballeros.csv
|
|
||||||
| histogram rusty_at countries
|
| histogram rusty_at countries
|
||||||
| where rusty_at == "Ecuador"
|
| where rusty_at == "Ecuador"
|
||||||
| get countries
|
| get countries
|
||||||
| get 0
|
| get 0
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "*********************************");
|
assert_eq!(actual.out, "*********************************");
|
||||||
// 33%
|
// 33%
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn summarizes_by_values() {
|
fn summarizes_by_values() {
|
||||||
Playground::setup("histogram_test_2", |dirs, sandbox| {
|
let actual = nu!(pipeline(&format!(
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
|
||||||
"los_tres_caballeros.csv",
|
|
||||||
r#"
|
r#"
|
||||||
first_name,last_name,rusty_at
|
{SAMPLE_INPUT}
|
||||||
Andrés,Robalino,Ecuador
|
|
||||||
JT,Turner,Estados Unidos
|
|
||||||
Yehuda,Katz,Estados Unidos
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
|
||||||
open los_tres_caballeros.csv
|
|
||||||
| get rusty_at
|
| get rusty_at
|
||||||
| histogram
|
| histogram
|
||||||
| where value == "Estados Unidos"
|
| where value == "Estados Unidos"
|
||||||
| get count
|
| get count
|
||||||
| get 0
|
| get 0
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "2");
|
assert_eq!(actual.out, "2");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
||||||
use nu_test_support::playground::Playground;
|
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn all() {
|
fn all() {
|
||||||
Playground::setup("sum_test_1", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
|
||||||
"meals.json",
|
|
||||||
r#"
|
|
||||||
{
|
{
|
||||||
meals: [
|
meals: [
|
||||||
{description: "1 large egg", calories: 90},
|
{description: "1 large egg", calories: 90},
|
||||||
@ -16,21 +11,18 @@ fn all() {
|
|||||||
{description: "1 tablespoon fish oil", calories: 108}
|
{description: "1 tablespoon fish oil", calories: 108}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
"#,
|
"#;
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
r#"
|
||||||
open meals.json
|
{sample}
|
||||||
| get meals
|
| get meals
|
||||||
| get calories
|
| get calories
|
||||||
| math sum
|
| math sum
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "448");
|
assert_eq!(actual.out, "448");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,44 +1,27 @@
|
|||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
||||||
use nu_test_support::playground::Playground;
|
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn row() {
|
fn row() {
|
||||||
Playground::setup("merge_test_1", |dirs, sandbox| {
|
let left_sample = r#"[[name, country, luck];
|
||||||
sandbox.with_files(vec![
|
[Andrés, Ecuador, 0],
|
||||||
FileWithContentToBeTrimmed(
|
[JT, USA, 0],
|
||||||
"caballeros.csv",
|
[Jason, Canada, 0],
|
||||||
r#"
|
[Yehuda, USA, 0]]"#;
|
||||||
name,country,luck
|
|
||||||
Andrés,Ecuador,0
|
|
||||||
JT,USA,0
|
|
||||||
Jason,Canada,0
|
|
||||||
Yehuda,USA,0
|
|
||||||
"#,
|
|
||||||
),
|
|
||||||
FileWithContentToBeTrimmed(
|
|
||||||
"new_caballeros.csv",
|
|
||||||
r#"
|
|
||||||
name,country,luck
|
|
||||||
Andrés Robalino,Guayaquil Ecuador,1
|
|
||||||
JT Turner,New Zealand,1
|
|
||||||
"#,
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let right_sample = r#"[[name, country, luck];
|
||||||
cwd: dirs.test(), pipeline(
|
["Andrés Robalino", "Guayaquil Ecuador", 1],
|
||||||
r#"
|
["JT Turner", "New Zealand", 1]]"#;
|
||||||
open caballeros.csv
|
|
||||||
| merge (open new_caballeros.csv)
|
let actual = nu!(pipeline(&format!(
|
||||||
|
r#" ({left_sample})
|
||||||
|
| merge ({right_sample})
|
||||||
| where country in ["Guayaquil Ecuador" "New Zealand"]
|
| where country in ["Guayaquil Ecuador" "New Zealand"]
|
||||||
| get luck
|
| get luck
|
||||||
| math sum
|
| math sum
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "2");
|
assert_eq!(actual.out, "2");
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,130 +1,102 @@
|
|||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
||||||
use nu_test_support::playground::Playground;
|
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn moves_a_column_before() {
|
fn moves_a_column_before() {
|
||||||
Playground::setup("move_column_test_1", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[[column1 column2 column3 ... column98 column99 column100];
|
||||||
"sample.csv",
|
[------- ------- ------- --- -------- " A " ---------],
|
||||||
r#"
|
[------- ------- ------- --- -------- " N " ---------],
|
||||||
column1,column2,column3,...,column98,column99,column100
|
[------- ------- ------- --- -------- " D " ---------],
|
||||||
-------,-------,-------,---,--------, A ,---------
|
[------- ------- ------- --- -------- " R " ---------],
|
||||||
-------,-------,-------,---,--------, N ,---------
|
[------- ------- ------- --- -------- " E " ---------],
|
||||||
-------,-------,-------,---,--------, D ,---------
|
[------- ------- ------- --- -------- " S " ---------]]"#;
|
||||||
-------,-------,-------,---,--------, R ,---------
|
|
||||||
-------,-------,-------,---,--------, E ,---------
|
|
||||||
-------,-------,-------,---,--------, S ,---------
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
r#"
|
||||||
open sample.csv
|
{sample}
|
||||||
| move column99 --before column1
|
| move column99 --before column1
|
||||||
| rename chars
|
| rename chars
|
||||||
| get chars
|
| get chars
|
||||||
| str trim
|
| str trim
|
||||||
| str join
|
| str join
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert!(actual.out.contains("ANDRES"));
|
assert!(actual.out.contains("ANDRES"));
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn moves_columns_before() {
|
fn moves_columns_before() {
|
||||||
Playground::setup("move_column_test_2", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[[column1 column2 column3 ... column98 column99 column100];
|
||||||
"sample.csv",
|
[------- ------- " A " --- -------- " N " ---------]
|
||||||
r#"
|
[------- ------- " D " --- -------- " R " ---------]
|
||||||
column1,column2,column3,...,column98,column99,column100
|
[------- ------- " E " --- -------- " S " ---------]
|
||||||
-------,-------, A ,---,--------, N ,---------
|
[------- ------- " : " --- -------- " : " ---------]
|
||||||
-------,-------, D ,---,--------, R ,---------
|
[------- ------- " J " --- -------- " T " ---------]]"#;
|
||||||
-------,-------, E ,---,--------, S ,---------
|
|
||||||
-------,-------, : ,---,--------, : ,---------
|
|
||||||
-------,-------, J ,---,--------, T ,---------
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
r#"
|
||||||
open sample.csv
|
{sample}
|
||||||
| move column99 column3 --before column2
|
| move column99 column3 --before column2
|
||||||
| rename _ chars_1 chars_2
|
| rename _ chars_1 chars_2
|
||||||
| select chars_2 chars_1
|
| select chars_2 chars_1
|
||||||
| upsert new_col {|f| $f | transpose | get column1 | str trim | str join}
|
| upsert new_col {{|f| $f | transpose | get column1 | str trim | str join}}
|
||||||
| get new_col
|
| get new_col
|
||||||
| str join
|
| str join
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert!(actual.out.contains("ANDRES::JT"));
|
assert!(actual.out.contains("ANDRES::JT"));
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn moves_a_column_after() {
|
fn moves_a_column_after() {
|
||||||
Playground::setup("move_column_test_3", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[[column1 column2 letters ... column98 and_more column100];
|
||||||
"sample.csv",
|
[------- ------- " A " --- -------- " N " ---------]
|
||||||
r#"
|
[------- ------- " D " --- -------- " R " ---------]
|
||||||
column1,column2,letters,...,column98,and_more,column100
|
[------- ------- " E " --- -------- " S " ---------]
|
||||||
-------,-------, A ,---,--------, N ,---------
|
[------- ------- " : " --- -------- " : " ---------]
|
||||||
-------,-------, D ,---,--------, R ,---------
|
[------- ------- " J " --- -------- " T " ---------]]
|
||||||
-------,-------, E ,---,--------, S ,---------
|
"#;
|
||||||
-------,-------, : ,---,--------, : ,---------
|
|
||||||
-------,-------, J ,---,--------, T ,---------
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
r#"
|
||||||
open sample.csv
|
{sample}
|
||||||
| move letters --after and_more
|
| move letters --after and_more
|
||||||
| move letters and_more --before column2
|
| move letters and_more --before column2
|
||||||
| rename _ chars_1 chars_2
|
| rename _ chars_1 chars_2
|
||||||
| select chars_1 chars_2
|
| select chars_1 chars_2
|
||||||
| upsert new_col {|f| $f | transpose | get column1 | str trim | str join}
|
| upsert new_col {{|f| $f | transpose | get column1 | str trim | str join}}
|
||||||
| get new_col
|
| get new_col
|
||||||
| str join
|
| str join
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert!(actual.out.contains("ANDRES::JT"));
|
assert!(actual.out.contains("ANDRES::JT"));
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn moves_columns_after() {
|
fn moves_columns_after() {
|
||||||
Playground::setup("move_column_test_4", |dirs, sandbox| {
|
let content = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[[column1 column2 letters ... column98 and_more column100];
|
||||||
"sample.csv",
|
[------- ------- " A " --- -------- " N " ---------]
|
||||||
r#"
|
[------- ------- " D " --- -------- " R " ---------]
|
||||||
column1,column2,letters,...,column98,and_more,column100
|
[------- ------- " E " --- -------- " S " ---------]
|
||||||
-------,-------, A ,---,--------, N ,---------
|
[------- ------- " : " --- -------- " : " ---------]
|
||||||
-------,-------, D ,---,--------, R ,---------
|
[------- ------- " J " --- -------- " T " ---------]]
|
||||||
-------,-------, E ,---,--------, S ,---------
|
"#;
|
||||||
-------,-------, : ,---,--------, : ,---------
|
|
||||||
-------,-------, J ,---,--------, T ,---------
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
r#"
|
||||||
open sample.csv
|
{content}
|
||||||
| move letters and_more --after column1
|
| move letters and_more --after column1
|
||||||
| columns
|
| columns
|
||||||
| select 1 2
|
| select 1 2
|
||||||
| str join
|
| str join
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert!(actual.out.contains("lettersand_more"));
|
assert!(actual.out.contains("lettersand_more"));
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
@ -1,116 +1,85 @@
|
|||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
||||||
use nu_test_support::playground::Playground;
|
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn changes_the_column_name() {
|
fn changes_the_column_name() {
|
||||||
Playground::setup("rename_test_1", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[["Andrés N. Robalino"],
|
||||||
"los_cuatro_mosqueteros.txt",
|
["JT Turner"],
|
||||||
r#"
|
["Yehuda Katz"],
|
||||||
Andrés N. Robalino
|
["Jason Gedge"]]
|
||||||
JT Turner
|
"#;
|
||||||
Yehuda Katz
|
|
||||||
Jason Gedge
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
" {sample}
|
||||||
"
|
|
||||||
open los_cuatro_mosqueteros.txt
|
|
||||||
| lines
|
|
||||||
| wrap name
|
| wrap name
|
||||||
| rename mosqueteros
|
| rename mosqueteros
|
||||||
| get mosqueteros
|
| get mosqueteros
|
||||||
| length
|
| length
|
||||||
"
|
"
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "4");
|
assert_eq!(actual.out, "4");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn keeps_remaining_original_names_given_less_new_names_than_total_original_names() {
|
fn keeps_remaining_original_names_given_less_new_names_than_total_original_names() {
|
||||||
Playground::setup("rename_test_2", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[["Andrés N. Robalino"],
|
||||||
"los_cuatro_mosqueteros.txt",
|
["JT Turner"],
|
||||||
r#"
|
["Yehuda Katz"],
|
||||||
Andrés N. Robalino
|
["Jason Gedge"]]
|
||||||
JT Turner
|
"#;
|
||||||
Yehuda Katz
|
|
||||||
Jason Gedge
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
r#"
|
||||||
open los_cuatro_mosqueteros.txt
|
{sample}
|
||||||
| lines
|
|
||||||
| wrap name
|
| wrap name
|
||||||
| default "arepa!" hit
|
| default "arepa!" hit
|
||||||
| rename mosqueteros
|
| rename mosqueteros
|
||||||
| get hit
|
| get hit
|
||||||
| length
|
| length
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "4");
|
assert_eq!(actual.out, "4");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn errors_if_no_columns_present() {
|
fn errors_if_no_columns_present() {
|
||||||
Playground::setup("rename_test_3", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[["Andrés N. Robalino"],
|
||||||
"los_cuatro_mosqueteros.txt",
|
["JT Turner"],
|
||||||
r#"
|
["Yehuda Katz"],
|
||||||
Andrés N. Robalino
|
["Jason Gedge"]]
|
||||||
JT Turner
|
"#;
|
||||||
Yehuda Katz
|
|
||||||
Jason Gedge
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
"
|
"
|
||||||
open los_cuatro_mosqueteros.txt
|
{sample}
|
||||||
| lines
|
|
||||||
| rename mosqueteros
|
| rename mosqueteros
|
||||||
"
|
"
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert!(actual.err.contains("command doesn't support"));
|
assert!(actual.err.contains("command doesn't support"));
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn errors_if_columns_param_is_empty() {
|
fn errors_if_columns_param_is_empty() {
|
||||||
Playground::setup("rename_test_4", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[["Andrés N. Robalino"],
|
||||||
"los_cuatro_mosqueteros.txt",
|
["JT Turner"],
|
||||||
r#"
|
["Yehuda Katz"],
|
||||||
Andrés N. Robalino
|
["Jason Gedge"]]
|
||||||
JT Turner
|
"#;
|
||||||
Yehuda Katz
|
|
||||||
Jason Gedge
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
r#"
|
||||||
open los_cuatro_mosqueteros.txt
|
{sample}
|
||||||
| lines
|
|
||||||
| wrap name
|
| wrap name
|
||||||
| default "arepa!" hit
|
| default "arepa!" hit
|
||||||
| rename --column {}
|
| rename --column {{}}
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert!(actual.err.contains("The column info cannot be empty"));
|
assert!(actual.err.contains("The column info cannot be empty"));
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use nu_test_support::fs::Stub::{EmptyFile, FileWithContentToBeTrimmed};
|
use nu_test_support::fs::Stub::EmptyFile;
|
||||||
use nu_test_support::playground::Playground;
|
use nu_test_support::playground::Playground;
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
@ -24,10 +24,7 @@ fn regular_columns() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn complex_nested_columns() {
|
fn complex_nested_columns() {
|
||||||
Playground::setup("select_test_2", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
|
||||||
"los_tres_caballeros.json",
|
|
||||||
r#"
|
|
||||||
{
|
{
|
||||||
"nu": {
|
"nu": {
|
||||||
"committers": [
|
"committers": [
|
||||||
@ -47,22 +44,19 @@ fn complex_nested_columns() {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"#,
|
"#;
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
r#"
|
||||||
open los_tres_caballeros.json
|
{sample}
|
||||||
| select nu."0xATYKARNU" nu.committers.name nu.releases.version
|
| select nu."0xATYKARNU" nu.committers.name nu.releases.version
|
||||||
| get nu_releases_version
|
| get nu_releases_version
|
||||||
| where $it > "0.8"
|
| where $it > "0.8"
|
||||||
| get 0
|
| get 0
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "0.9999999");
|
assert_eq!(actual.out, "0.9999999");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,53 +1,38 @@
|
|||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
||||||
use nu_test_support::playground::Playground;
|
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn condition_is_met() {
|
fn condition_is_met() {
|
||||||
Playground::setup("skip_until_test_1", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[["Chicken Collection", "29/04/2020", "30/04/2020", "31/04/2020"];
|
||||||
"caballeros.txt",
|
["Yellow Chickens", "", "", ""],
|
||||||
r#"
|
[Andrés, 0, 0, 1],
|
||||||
CHICKEN SUMMARY report date: April 29th, 2020
|
[JT, 0, 0, 1],
|
||||||
--------------------------------------------------------------------
|
[Jason, 0, 0, 1],
|
||||||
Chicken Collection,29/04/2020,30/04/2020,31/04/2020
|
[Yehuda, 0, 0, 1],
|
||||||
Yellow Chickens,,,
|
["Blue Chickens", "", "", ""],
|
||||||
Andrés,0,0,1
|
[Andrés, 0, 0, 2],
|
||||||
JT,0,0,1
|
[JT, 0, 0, 2],
|
||||||
Jason,0,0,1
|
[Jason, 0, 0, 2],
|
||||||
Yehuda,0,0,1
|
[Yehuda, 0, 0, 2],
|
||||||
Blue Chickens,,,
|
["Red Chickens", "", "", ""],
|
||||||
Andrés,0,0,1
|
[Andrés, 0, 0, 1],
|
||||||
JT,0,0,1
|
[JT, 0, 0, 1],
|
||||||
Jason,0,0,1
|
[Jason, 0, 0, 1],
|
||||||
Yehuda,0,0,2
|
[Yehuda, 0, 0, 3]]
|
||||||
Red Chickens,,,
|
"#;
|
||||||
Andrés,0,0,1
|
|
||||||
JT,0,0,1
|
|
||||||
Jason,0,0,1
|
|
||||||
Yehuda,0,0,3
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
r#"
|
||||||
open --raw ./caballeros.txt
|
{sample}
|
||||||
| lines
|
| skip until {{|row| $row."Chicken Collection" == "Red Chickens" }}
|
||||||
| skip 2
|
|
||||||
| str trim
|
|
||||||
| str join (char nl)
|
|
||||||
| from csv
|
|
||||||
| skip until {|row| $row."Chicken Collection" == "Red Chickens" }
|
|
||||||
| skip 1
|
| skip 1
|
||||||
| into int "31/04/2020"
|
| into int "31/04/2020"
|
||||||
| get "31/04/2020"
|
| get "31/04/2020"
|
||||||
| math sum
|
| math sum
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "6");
|
assert_eq!(actual.out, "6");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,53 +1,38 @@
|
|||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
||||||
use nu_test_support::playground::Playground;
|
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn condition_is_met() {
|
fn condition_is_met() {
|
||||||
Playground::setup("skip_while_test_1", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[["Chicken Collection", "29/04/2020", "30/04/2020", "31/04/2020"];
|
||||||
"caballeros.txt",
|
["Yellow Chickens", "", "", ""],
|
||||||
r#"
|
[Andrés, 0, 0, 1],
|
||||||
CHICKEN SUMMARY report date: April 29th, 2020
|
[JT, 0, 0, 1],
|
||||||
--------------------------------------------------------------------
|
[Jason, 0, 0, 1],
|
||||||
Chicken Collection,29/04/2020,30/04/2020,31/04/2020
|
[Yehuda, 0, 0, 1],
|
||||||
Yellow Chickens,,,
|
["Blue Chickens", "", "", ""],
|
||||||
Andrés,0,0,1
|
[Andrés, 0, 0, 2],
|
||||||
JT,0,0,1
|
[JT, 0, 0, 2],
|
||||||
Jason,0,0,1
|
[Jason, 0, 0, 2],
|
||||||
Yehuda,0,0,1
|
[Yehuda, 0, 0, 2],
|
||||||
Blue Chickens,,,
|
["Red Chickens", "", "", ""],
|
||||||
Andrés,0,0,1
|
[Andrés, 0, 0, 1],
|
||||||
JT,0,0,1
|
[JT, 0, 0, 1],
|
||||||
Jason,0,0,1
|
[Jason, 0, 0, 1],
|
||||||
Yehuda,0,0,2
|
[Yehuda, 0, 0, 3]]
|
||||||
Red Chickens,,,
|
"#;
|
||||||
Andrés,0,0,1
|
|
||||||
JT,0,0,1
|
|
||||||
Jason,0,0,1
|
|
||||||
Yehuda,0,0,3
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
r#"
|
||||||
open --raw caballeros.txt
|
{sample}
|
||||||
| lines
|
| skip while {{|row| $row."Chicken Collection" != "Red Chickens" }}
|
||||||
| skip 2
|
|
||||||
| str trim
|
|
||||||
| str join (char nl)
|
|
||||||
| from csv
|
|
||||||
| skip while {|row| $row."Chicken Collection" != "Red Chickens" }
|
|
||||||
| skip 1
|
| skip 1
|
||||||
| into int "31/04/2020"
|
| into int "31/04/2020"
|
||||||
| get "31/04/2020"
|
| get "31/04/2020"
|
||||||
| math sum
|
| math sum
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "6");
|
assert_eq!(actual.out, "6");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,33 +1,27 @@
|
|||||||
use nu_test_support::fs::Stub::{EmptyFile, FileWithContentToBeTrimmed};
|
use nu_test_support::fs::Stub::EmptyFile;
|
||||||
use nu_test_support::playground::Playground;
|
use nu_test_support::playground::Playground;
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn splits() {
|
fn splits() {
|
||||||
Playground::setup("split_by_test_1", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[[first_name, last_name, rusty_at, type];
|
||||||
"los_tres_caballeros.csv",
|
[Andrés, Robalino, "10/11/2013", A],
|
||||||
r#"
|
[JT, Turner, "10/12/2013", B],
|
||||||
first_name,last_name,rusty_at,type
|
[Yehuda, Katz, "10/11/2013", A]]
|
||||||
Andrés,Robalino,10/11/2013,A
|
"#;
|
||||||
JT,Turner,10/12/2013,B
|
|
||||||
Yehuda,Katz,10/11/2013,A
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
r#"
|
||||||
open los_tres_caballeros.csv
|
{sample}
|
||||||
| group-by rusty_at
|
| group-by rusty_at
|
||||||
| split-by type
|
| split-by type
|
||||||
| get A."10/11/2013"
|
| get A."10/11/2013"
|
||||||
| length
|
| length
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "2");
|
assert_eq!(actual.out, "2");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,33 +1,24 @@
|
|||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
||||||
use nu_test_support::playground::Playground;
|
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn rows() {
|
fn rows() {
|
||||||
Playground::setup("take_test_1", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[[name, lucky_code];
|
||||||
"caballeros.csv",
|
[Andrés, 1],
|
||||||
r#"
|
[JT , 1],
|
||||||
name,lucky_code
|
[Jason , 2],
|
||||||
Andrés,1
|
[Yehuda, 1]]"#;
|
||||||
JT,1
|
|
||||||
Jason,2
|
|
||||||
Yehuda,1
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
r#"
|
||||||
open caballeros.csv
|
{sample}
|
||||||
| take 3
|
| take 3
|
||||||
| get lucky_code
|
| get lucky_code
|
||||||
| math sum
|
| math sum
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "4");
|
assert_eq!(actual.out, "4");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,54 +1,39 @@
|
|||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
||||||
use nu_test_support::playground::Playground;
|
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn condition_is_met() {
|
fn condition_is_met() {
|
||||||
Playground::setup("take_until_test_1", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[["Chicken Collection", "29/04/2020", "30/04/2020", "31/04/2020"];
|
||||||
"caballeros.txt",
|
["Yellow Chickens", "", "", ""],
|
||||||
r#"
|
[Andrés, 1, 1, 1],
|
||||||
CHICKEN SUMMARY report date: April 29th, 2020
|
[JT, 1, 1, 1],
|
||||||
--------------------------------------------------------------------
|
[Jason, 1, 1, 1],
|
||||||
Chicken Collection,29/04/2020,30/04/2020,31/04/2020
|
[Yehuda, 1, 1, 1],
|
||||||
Yellow Chickens,,,
|
["Blue Chickens", "", "", ""],
|
||||||
Andrés,1,1,1
|
[Andrés, 1, 1, 2],
|
||||||
JT,1,1,1
|
[JT, 1, 1, 2],
|
||||||
Jason,1,1,1
|
[Jason, 1, 1, 2],
|
||||||
Yehuda,1,1,1
|
[Yehuda, 1, 1, 2],
|
||||||
Blue Chickens,,,
|
["Red Chickens", "", "", ""],
|
||||||
Andrés,1,1,2
|
[Andrés, 1, 1, 3],
|
||||||
JT,1,1,2
|
[JT, 1, 1, 3],
|
||||||
Jason,1,1,2
|
[Jason, 1, 1, 3],
|
||||||
Yehuda,1,1,2
|
[Yehuda, 1, 1, 3]]
|
||||||
Red Chickens,,,
|
"#;
|
||||||
Andrés,1,1,3
|
|
||||||
JT,1,1,3
|
|
||||||
Jason,1,1,3
|
|
||||||
Yehuda,1,1,3
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
r#"
|
||||||
open --raw caballeros.txt
|
{sample}
|
||||||
| lines
|
| skip while {{|row| $row."Chicken Collection" != "Blue Chickens" }}
|
||||||
| skip 2
|
| take until {{|row| $row."Chicken Collection" == "Red Chickens" }}
|
||||||
| str trim
|
|
||||||
| str join (char nl)
|
|
||||||
| from csv
|
|
||||||
| skip while {|row| $row."Chicken Collection" != "Blue Chickens" }
|
|
||||||
| take until {|row| $row."Chicken Collection" == "Red Chickens" }
|
|
||||||
| skip 1
|
| skip 1
|
||||||
| into int "31/04/2020"
|
| into int "31/04/2020"
|
||||||
| get "31/04/2020"
|
| get "31/04/2020"
|
||||||
| math sum
|
| math sum
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "8");
|
assert_eq!(actual.out, "8");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,53 +1,38 @@
|
|||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
||||||
use nu_test_support::playground::Playground;
|
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn condition_is_met() {
|
fn condition_is_met() {
|
||||||
Playground::setup("take_while_test_1", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[["Chicken Collection", "29/04/2020", "30/04/2020", "31/04/2020"];
|
||||||
"caballeros.txt",
|
["Yellow Chickens", "", "", ""],
|
||||||
r#"
|
[Andrés, 1, 1, 1],
|
||||||
CHICKEN SUMMARY report date: April 29th, 2020
|
[JT, 1, 1, 1],
|
||||||
--------------------------------------------------------------------
|
[Jason, 1, 1, 1],
|
||||||
Chicken Collection,29/04/2020,30/04/2020,31/04/2020
|
[Yehuda, 1, 1, 1],
|
||||||
Yellow Chickens,,,
|
["Blue Chickens", "", "", ""],
|
||||||
Andrés,1,1,1
|
[Andrés, 1, 1, 2],
|
||||||
JT,1,1,1
|
[JT, 1, 1, 2],
|
||||||
Jason,1,1,1
|
[Jason, 1, 1, 2],
|
||||||
Yehuda,1,1,1
|
[Yehuda, 1, 1, 2],
|
||||||
Blue Chickens,,,
|
["Red Chickens", "", "", ""],
|
||||||
Andrés,1,1,2
|
[Andrés, 1, 1, 3],
|
||||||
JT,1,1,2
|
[JT, 1, 1, 3],
|
||||||
Jason,1,1,2
|
[Jason, 1, 1, 3],
|
||||||
Yehuda,1,1,2
|
[Yehuda, 1, 1, 3]]
|
||||||
Red Chickens,,,
|
"#;
|
||||||
Andrés,1,1,3
|
|
||||||
JT,1,1,3
|
|
||||||
Jason,1,1,3
|
|
||||||
Yehuda,1,1,3
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
r#"
|
r#"
|
||||||
open --raw caballeros.txt
|
{sample}
|
||||||
| lines
|
|
||||||
| skip 2
|
|
||||||
| str trim
|
|
||||||
| str join (char nl)
|
|
||||||
| from csv
|
|
||||||
| skip 1
|
| skip 1
|
||||||
| take while {|row| $row."Chicken Collection" != "Blue Chickens"}
|
| take while {{|row| $row."Chicken Collection" != "Blue Chickens"}}
|
||||||
| into int "31/04/2020"
|
| into int "31/04/2020"
|
||||||
| get "31/04/2020"
|
| get "31/04/2020"
|
||||||
| math sum
|
| math sum
|
||||||
"#
|
"#
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "4");
|
assert_eq!(actual.out, "4");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,62 +1,27 @@
|
|||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
||||||
use nu_test_support::playground::Playground;
|
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
|
const SAMPLE_CSV_CONTENT: &str = r#"
|
||||||
|
[[first_name, last_name, rusty_at, type];
|
||||||
|
[Andrés, Robalino, "10/11/2013", A],
|
||||||
|
[JT, Turner, "10/12/2013", B],
|
||||||
|
[Yehuda, Katz, "10/11/2013", A],
|
||||||
|
[JT, Turner, "10/12/2013", B],
|
||||||
|
[Yehuda, Katz, "10/11/2013", A]]
|
||||||
|
"#;
|
||||||
#[test]
|
#[test]
|
||||||
fn removes_duplicate_rows() {
|
fn removes_duplicate_rows() {
|
||||||
Playground::setup("uniq_test_1", |dirs, sandbox| {
|
let actual = nu!(pipeline(&format!("{SAMPLE_CSV_CONTENT} | uniq | length ")));
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
|
||||||
"los_tres_caballeros.csv",
|
|
||||||
r#"
|
|
||||||
first_name,last_name,rusty_at,type
|
|
||||||
Andrés,Robalino,10/11/2013,A
|
|
||||||
JT,Turner,10/12/2013,B
|
|
||||||
Yehuda,Katz,10/11/2013,A
|
|
||||||
JT,Turner,10/12/2013,B
|
|
||||||
Yehuda,Katz,10/11/2013,A
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
"
|
|
||||||
open los_tres_caballeros.csv
|
|
||||||
| uniq
|
|
||||||
| length
|
|
||||||
"
|
|
||||||
));
|
|
||||||
|
|
||||||
assert_eq!(actual.out, "3");
|
assert_eq!(actual.out, "3");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn uniq_values() {
|
fn uniq_values() {
|
||||||
Playground::setup("uniq_test_2", |dirs, sandbox| {
|
let actual = nu!(pipeline(&format!(
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
"{SAMPLE_CSV_CONTENT} | select type | uniq | length ",
|
||||||
"los_tres_caballeros.csv",
|
)));
|
||||||
r#"
|
|
||||||
first_name,last_name,rusty_at,type
|
|
||||||
Andrés,Robalino,10/11/2013,A
|
|
||||||
JT,Turner,10/12/2013,B
|
|
||||||
Yehuda,Katz,10/11/2013,A
|
|
||||||
JT,Turner,10/12/2013,B
|
|
||||||
Yehuda,Katz,10/11/2013,A
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
"
|
|
||||||
open los_tres_caballeros.csv
|
|
||||||
| select type
|
|
||||||
| uniq
|
|
||||||
| length
|
|
||||||
"
|
|
||||||
));
|
|
||||||
|
|
||||||
assert_eq!(actual.out, "2");
|
assert_eq!(actual.out, "2");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -68,10 +33,7 @@ fn uniq_empty() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn nested_json_structures() {
|
fn nested_json_structures() {
|
||||||
Playground::setup("uniq_test_3", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
|
||||||
"nested_json_structures.json",
|
|
||||||
r#"
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "this is duplicated",
|
"name": "this is duplicated",
|
||||||
@ -114,19 +76,11 @@ fn nested_json_structures() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
"#,
|
"#;
|
||||||
)]);
|
|
||||||
|
let actual = nu!(pipeline(&format!("'{sample}' | from json | uniq | length")));
|
||||||
|
|
||||||
let actual = nu!(
|
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
"
|
|
||||||
open nested_json_structures.json
|
|
||||||
| uniq
|
|
||||||
| length
|
|
||||||
"
|
|
||||||
));
|
|
||||||
assert_eq!(actual.out, "3");
|
assert_eq!(actual.out, "3");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,32 +1,24 @@
|
|||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
||||||
use nu_test_support::playground::Playground;
|
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn removes_duplicate_rows() {
|
fn removes_duplicate_rows() {
|
||||||
Playground::setup("uniq_test_1", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[[first_name , last_name, rusty_at, type];
|
||||||
"los_tres_caballeros.csv",
|
[Andrés , Robalino, "10/11/2013", A],
|
||||||
r#"
|
[Afonso , Turner, "10/12/2013", B],
|
||||||
first_name,last_name,rusty_at,type
|
[Yehuda , Katz, "10/11/2013", A],
|
||||||
Andrés,Robalino,10/11/2013,A
|
[JT , Turner, "11/12/2011", O]]
|
||||||
Afonso,Turner,10/12/2013,B
|
"#;
|
||||||
Yehuda,Katz,10/11/2013,A
|
|
||||||
JT,Turner,11/12/2011,O
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
"
|
"
|
||||||
open los_tres_caballeros.csv
|
{sample}
|
||||||
| uniq-by last_name
|
| uniq-by last_name
|
||||||
| length
|
| length
|
||||||
"
|
"
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "3");
|
assert_eq!(actual.out, "3");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,61 +1,45 @@
|
|||||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|
||||||
use nu_test_support::playground::Playground;
|
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn wrap_rows_into_a_row() {
|
fn wrap_rows_into_a_row() {
|
||||||
Playground::setup("wrap_test_1", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[[first_name, last_name];
|
||||||
"los_tres_caballeros.txt",
|
[Andrés, Robalino],
|
||||||
r#"
|
[JT, Turner],
|
||||||
first_name,last_name
|
[Yehuda, Katz]]
|
||||||
Andrés,Robalino
|
"#;
|
||||||
JT,Turner
|
|
||||||
Yehuda,Katz
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
"
|
"
|
||||||
open los_tres_caballeros.txt
|
{sample}
|
||||||
| from csv
|
|
||||||
| wrap caballeros
|
| wrap caballeros
|
||||||
| get caballeros
|
| get caballeros
|
||||||
| get 0
|
| get 0
|
||||||
| get last_name
|
| get last_name
|
||||||
"
|
"
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "Robalino");
|
assert_eq!(actual.out, "Robalino");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn wrap_rows_into_a_table() {
|
fn wrap_rows_into_a_table() {
|
||||||
Playground::setup("wrap_test_2", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[[first_name, last_name];
|
||||||
"los_tres_caballeros.txt",
|
[Andrés, Robalino],
|
||||||
r#"
|
[JT, Turner],
|
||||||
first_name,last_name
|
[Yehuda, Katz]]
|
||||||
Andrés,Robalino
|
"#;
|
||||||
JT,Turner
|
|
||||||
Yehuda,Katz
|
|
||||||
"#,
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
"
|
"
|
||||||
open los_tres_caballeros.txt
|
{sample}
|
||||||
| from csv
|
|
||||||
| get last_name
|
| get last_name
|
||||||
| wrap caballero
|
| wrap caballero
|
||||||
| get 2
|
| get 2
|
||||||
| get caballero
|
| get caballero
|
||||||
"
|
"
|
||||||
));
|
)));
|
||||||
|
|
||||||
assert_eq!(actual.out, "Katz");
|
assert_eq!(actual.out, "Katz");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
@ -5,31 +5,25 @@ use pretty_assertions::assert_eq;
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn takes_rows_of_nu_value_strings_and_pipes_it_to_stdin_of_external() {
|
fn takes_rows_of_nu_value_strings_and_pipes_it_to_stdin_of_external() {
|
||||||
Playground::setup("internal_to_external_pipe_test_1", |dirs, sandbox| {
|
let sample = r#"
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
[[name, rusty_luck, origin];
|
||||||
"nu_times.csv",
|
[Jason, 1, Canada],
|
||||||
"
|
[JT, 1, "New Zealand"],
|
||||||
name,rusty_luck,origin
|
[Andrés, 1, Ecuador],
|
||||||
Jason,1,Canada
|
[AndKitKatz, 1, "Estados Unidos"]]
|
||||||
JT,1,New Zealand
|
"#;
|
||||||
Andrés,1,Ecuador
|
|
||||||
AndKitKatz,1,Estados Unidos
|
|
||||||
",
|
|
||||||
)]);
|
|
||||||
|
|
||||||
let actual = nu!(
|
let actual = nu!(pipeline(&format!(
|
||||||
cwd: dirs.test(), pipeline(
|
|
||||||
"
|
"
|
||||||
open nu_times.csv
|
{sample}
|
||||||
| get origin
|
| get origin
|
||||||
| each { |it| nu --testbin cococo $it | nu --testbin chop }
|
| each {{ |it| nu --testbin cococo $it | nu --testbin chop }}
|
||||||
| get 2
|
| get 2
|
||||||
"
|
"
|
||||||
));
|
)));
|
||||||
|
|
||||||
// chop will remove the last escaped double quote from \"Estados Unidos\"
|
// chop will remove the last escaped double quote from \"Estados Unidos\"
|
||||||
assert_eq!(actual.out, "Ecuado");
|
assert_eq!(actual.out, "Ecuado");
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -111,7 +105,7 @@ fn subexpression_handles_dot() {
|
|||||||
));
|
));
|
||||||
|
|
||||||
assert_eq!(actual.out, "AndKitKat");
|
assert_eq!(actual.out, "AndKitKat");
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
Reference in New Issue
Block a user