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

View File

@ -49,6 +49,7 @@ fn fetches_by_index() {
assert_eq!(actual.out, "Andrés N. Robalino <andres@androbtech.com>");
})
}
#[test]
fn fetches_by_column_path() {
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]
fn errors_fetching_by_column_not_present() {
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("There isn't a column named 'taco'"),);
assert!(actual.err.contains("Perhaps you meant 'taconushell'?"),);
assert!(actual
.err
.contains("Columns available: pizzanushell, taconushell"),);
assert!(actual.err.contains("Name not found"),);
assert!(actual.err.contains("did you mean 'taconushell'"),);
})
}
// FIXME: jt: needs more work
#[ignore]
#[test]
fn errors_fetching_by_column_using_a_number() {
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
.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]
fn errors_fetching_by_index_out_of_bounds() {
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("There isn't a row indexed at 3"),);
assert!(actual.err.contains("The table only has 3 rows (0 to 2)"),)
assert!(actual.err.contains("Row number too large (max: 3)"),);
assert!(actual.err.contains("too large"),);
})
}

View File

@ -5,7 +5,7 @@ fn base64_defaults_to_encoding_with_standard_character_type() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo 'username:password' | hash base64
echo 'username:password' | hash base64
"#
)
);
@ -88,14 +88,12 @@ fn error_use_both_flags() {
.contains("only one of --decode and --encode flags can be used"));
}
// FIXME: jt: needs more work
#[ignore]
#[test]
fn md5_works_with_file() {
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
r#"
open sample.db | hash md5
open sample.db | hash md5
"#
)
);
@ -103,8 +101,6 @@ fn md5_works_with_file() {
assert_eq!(actual.out, "4de97601d232c427977ef11db396c951");
}
// FIXME: jt: needs more work
#[ignore]
#[test]
fn sha256_works_with_file() {
let actual = nu!(