a few more tests (#4488)

This commit is contained in:
Darren Schroeder 2022-02-15 19:48:32 -06:00 committed by GitHub
parent e763a8dcef
commit 7e6430def0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 36 deletions

View File

@ -1,21 +1,15 @@
use nu_test_support::{nu, pipeline}; use nu_test_support::{nu, pipeline};
// FIXME: jt: needs more work
#[ignore]
#[test] #[test]
fn columns() { fn columns() {
let actual = nu!( let actual = nu!(
cwd: ".", pipeline(r#" cwd: ".", pipeline(r#"
echo [ echo [
[arepas, color]; [arepas, color];
[3, white] [3, white]
[8, yellow] [8, yellow]
[4, white] [4, white]
] ] | drop column | columns | length
| drop column
| get
| length
"#) "#)
); );
@ -30,14 +24,10 @@ fn more_columns_than_table_has() {
cwd: ".", pipeline(r#" cwd: ".", pipeline(r#"
echo [ echo [
[arepas, color]; [arepas, color];
[3, white] [3, white]
[8, yellow] [8, yellow]
[4, white] [4, white]
] ] | drop column 3 | columns | empty?
| drop column 3
| get
| empty?
"#) "#)
); );

View File

@ -49,6 +49,7 @@ fn fetches_by_index() {
assert_eq!(actual.out, "Andrés N. Robalino <andres@androbtech.com>"); assert_eq!(actual.out, "Andrés N. Robalino <andres@androbtech.com>");
}) })
} }
#[test] #[test]
fn fetches_by_column_path() { fn fetches_by_column_path() {
Playground::setup("get_test_3", |dirs, sandbox| { Playground::setup("get_test_3", |dirs, sandbox| {
@ -130,8 +131,6 @@ fn fetches_more_than_one_column_path() {
}) })
} }
// FIXME: jt: needs more work
#[ignore]
#[test] #[test]
fn errors_fetching_by_column_not_present() { fn errors_fetching_by_column_not_present() {
Playground::setup("get_test_6", |dirs, sandbox| { Playground::setup("get_test_6", |dirs, sandbox| {
@ -153,17 +152,11 @@ fn errors_fetching_by_column_not_present() {
"# "#
)); ));
assert!(actual.err.contains("Unknown column"),); assert!(actual.err.contains("Name not found"),);
assert!(actual.err.contains("There isn't a column named 'taco'"),); assert!(actual.err.contains("did you mean 'taconushell'"),);
assert!(actual.err.contains("Perhaps you meant 'taconushell'?"),);
assert!(actual
.err
.contains("Columns available: pizzanushell, taconushell"),);
}) })
} }
// FIXME: jt: needs more work
#[ignore]
#[test] #[test]
fn errors_fetching_by_column_using_a_number() { fn errors_fetching_by_column_using_a_number() {
Playground::setup("get_test_7", |dirs, sandbox| { Playground::setup("get_test_7", |dirs, sandbox| {
@ -183,16 +176,15 @@ fn errors_fetching_by_column_using_a_number() {
"# "#
)); ));
assert!(actual.err.contains("No rows available"),);
assert!(actual.err.contains("A row at '0' can't be indexed."),);
assert!(actual assert!(actual
.err .err
.contains("Appears to contain columns. Columns available: 0"),) .contains("Data cannot be accessed with a cell path"),);
assert!(actual
.err
.contains(" record<0: string> doesn't support cell paths"),);
}) })
} }
// FIXME: jt: needs more work
#[ignore]
#[test] #[test]
fn errors_fetching_by_index_out_of_bounds() { fn errors_fetching_by_index_out_of_bounds() {
Playground::setup("get_test_8", |dirs, sandbox| { Playground::setup("get_test_8", |dirs, sandbox| {
@ -212,9 +204,8 @@ fn errors_fetching_by_index_out_of_bounds() {
"# "#
)); ));
assert!(actual.err.contains("Row not found"),); assert!(actual.err.contains("Row number too large (max: 3)"),);
assert!(actual.err.contains("There isn't a row indexed at 3"),); assert!(actual.err.contains("too large"),);
assert!(actual.err.contains("The table only has 3 rows (0 to 2)"),)
}) })
} }

View File

@ -88,8 +88,6 @@ fn error_use_both_flags() {
.contains("only one of --decode and --encode flags can be used")); .contains("only one of --decode and --encode flags can be used"));
} }
// FIXME: jt: needs more work
#[ignore]
#[test] #[test]
fn md5_works_with_file() { fn md5_works_with_file() {
let actual = nu!( let actual = nu!(
@ -103,8 +101,6 @@ fn md5_works_with_file() {
assert_eq!(actual.out, "4de97601d232c427977ef11db396c951"); assert_eq!(actual.out, "4de97601d232c427977ef11db396c951");
} }
// FIXME: jt: needs more work
#[ignore]
#[test] #[test]
fn sha256_works_with_file() { fn sha256_works_with_file() {
let actual = nu!( let actual = nu!(