Fix warnings and old names (#8457)

# Description

This fixes up some clippy warnings and removes some old names/info from
our unit tests

# User-Facing Changes

Internal changes only

# Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
- `cargo test --workspace` to check that all tests pass

> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```

# After Submitting

If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
This commit is contained in:
JT 2023-03-15 18:54:55 +13:00 committed by GitHub
parent 57ce6a7c66
commit 61455b457d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 142 additions and 158 deletions

View File

@ -395,7 +395,7 @@ mod tests {
fn parses_empty_element() -> Result<(), roxmltree::Error> {
let source = "<nu></nu>";
assert_eq!(parse(source)?, content_tag("nu", indexmap! {}, &vec![]));
assert_eq!(parse(source)?, content_tag("nu", indexmap! {}, &[]));
Ok(())
}
@ -409,7 +409,7 @@ mod tests {
content_tag(
"nu",
indexmap! {},
&vec![content_string("La era de los tres caballeros")]
&[content_string("La era de los tres caballeros")]
)
);
@ -421,7 +421,7 @@ mod tests {
let source = "\
<nu>
<dev>Andrés</dev>
<dev>Jonathan</dev>
<dev>JT</dev>
<dev>Yehuda</dev>
</nu>";
@ -431,9 +431,9 @@ mod tests {
"nu",
indexmap! {},
&vec![
content_tag("dev", indexmap! {}, &vec![content_string("Andrés")]),
content_tag("dev", indexmap! {}, &vec![content_string("Jonathan")]),
content_tag("dev", indexmap! {}, &vec![content_string("Yehuda")])
content_tag("dev", indexmap! {}, &[content_string("Andrés")]),
content_tag("dev", indexmap! {}, &[content_string("JT")]),
content_tag("dev", indexmap! {}, &[content_string("Yehuda")])
]
)
);
@ -449,7 +449,7 @@ mod tests {
assert_eq!(
parse(source)?,
content_tag("nu", indexmap! {"version" => "2.0"}, &vec![])
content_tag("nu", indexmap! {"version" => "2.0"}, &[])
);
Ok(())
@ -467,10 +467,10 @@ mod tests {
content_tag(
"nu",
indexmap! {"version" => "2.0"},
&vec![content_tag(
&[content_tag(
"version",
indexmap! {},
&vec![content_string("2.0")]
&[content_string("2.0")]
)]
)
);
@ -486,7 +486,7 @@ mod tests {
assert_eq!(
parse(source)?,
content_tag("nu", indexmap! {"version" => "2.0", "age" => "25"}, &vec![])
content_tag("nu", indexmap! {"version" => "2.0", "age" => "25"}, &[])
);
Ok(())

View File

@ -45,7 +45,7 @@ fn checks_all_columns_of_a_table_is_true() {
echo [
[ first_name, last_name, rusty_at, likes ];
[ Andrés, Robalino, 10/11/2013, 1 ]
[ Jonathan, Turner, 10/12/2013, 1 ]
[ JT, Turner, 10/12/2013, 1 ]
[ Darren, Schroeder, 10/11/2013, 1 ]
[ Yehuda, Katz, 10/11/2013, 1 ]
]

View File

@ -21,7 +21,7 @@ fn checks_any_column_of_a_table_is_true() {
echo [
[ first_name, last_name, rusty_at, likes ];
[ Andrés, Robalino, 10/11/2013, 1 ]
[ Jonathan, Turner, 10/12/2013, 1 ]
[ JT, Turner, 10/12/2013, 1 ]
[ Darren, Schroeder, 10/11/2013, 1 ]
[ Yehuda, Katz, 10/11/2013, 1 ]
]

View File

@ -5,7 +5,7 @@ fn adds_a_row_to_the_end() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo [ "Andrés N. Robalino", "Jonathan Turner", "Yehuda Katz" ]
echo [ "Andrés N. Robalino", "JT Turner", "Yehuda Katz" ]
| append "pollo loco"
| get 3
"#

View File

@ -11,7 +11,7 @@ fn discards_rows_where_given_column_is_empty() {
{
"amigos": [
{"name": "Yehuda", "rusty_luck": 1},
{"name": "Jonathan", "rusty_luck": 1},
{"name": "JT", "rusty_luck": 1},
{"name": "Andres", "rusty_luck": 1},
{"name":"GorbyPuff"}
]

View File

@ -108,7 +108,7 @@ fn copies_the_directory_inside_directory_if_path_to_copy_is_directory_and_with_r
.within("originals")
.with_files(vec![
EmptyFile("yehuda.txt"),
EmptyFile("jonathan.txt"),
EmptyFile("jttxt"),
EmptyFile("andres.txt"),
])
.mkdir("expected");
@ -126,7 +126,7 @@ fn copies_the_directory_inside_directory_if_path_to_copy_is_directory_and_with_r
assert!(files_exist_at(
vec![
Path::new("yehuda.txt"),
Path::new("jonathan.txt"),
Path::new("jttxt"),
Path::new("andres.txt")
],
&expected_dir
@ -148,10 +148,10 @@ fn deep_copies_with_recursive_flag_impl(progress: bool) {
.within("originals/contributors")
.with_files(vec![
EmptyFile("yehuda.txt"),
EmptyFile("jonathan.txt"),
EmptyFile("jttxt"),
EmptyFile("andres.txt"),
])
.within("originals/contributors/jonathan")
.within("originals/contributors/JT")
.with_files(vec![EmptyFile("errors.txt"), EmptyFile("multishells.txt")])
.within("originals/contributors/andres")
.with_files(vec![EmptyFile("coverage.txt"), EmptyFile("commands.txt")])
@ -162,7 +162,7 @@ fn deep_copies_with_recursive_flag_impl(progress: bool) {
let expected_dir = dirs.test().join("expected").join("originals");
let progress_flag = if progress { "-p" } else { "" };
let jonathans_expected_copied_dir = expected_dir.join("contributors").join("jonathan");
let jts_expected_copied_dir = expected_dir.join("contributors").join("JT");
let andres_expected_copied_dir = expected_dir.join("contributors").join("andres");
let yehudas_expected_copied_dir = expected_dir.join("contributors").join("yehuda");
@ -175,7 +175,7 @@ fn deep_copies_with_recursive_flag_impl(progress: bool) {
assert!(expected_dir.exists());
assert!(files_exist_at(
vec![Path::new("errors.txt"), Path::new("multishells.txt")],
jonathans_expected_copied_dir
jts_expected_copied_dir
));
assert!(files_exist_at(
vec![Path::new("coverage.txt"), Path::new("commands.txt")],
@ -216,7 +216,7 @@ fn copies_using_path_with_wildcard_impl(progress: bool) {
vec![
Path::new("caco3_plastics.csv"),
Path::new("cargo_sample.toml"),
Path::new("jonathan.xml"),
Path::new("jt.xml"),
Path::new("sample.ini"),
Path::new("sgml_description.json"),
Path::new("utf16.ini"),
@ -261,7 +261,7 @@ fn copies_using_a_glob_impl(progress: bool) {
vec![
Path::new("caco3_plastics.csv"),
Path::new("cargo_sample.toml"),
Path::new("jonathan.xml"),
Path::new("jt.xml"),
Path::new("sample.ini"),
Path::new("sgml_description.json"),
Path::new("utf16.ini"),
@ -317,7 +317,7 @@ fn copy_files_using_glob_two_parents_up_using_multiple_dots() {
fn copy_files_using_glob_two_parents_up_using_multiple_dots_imp(progress: bool) {
Playground::setup("cp_test_9", |dirs, sandbox| {
sandbox.within("foo").within("bar").with_files(vec![
EmptyFile("jonathan.json"),
EmptyFile("jtjson"),
EmptyFile("andres.xml"),
EmptyFile("yehuda.yaml"),
EmptyFile("kevin.txt"),
@ -335,7 +335,7 @@ fn copy_files_using_glob_two_parents_up_using_multiple_dots_imp(progress: bool)
assert!(files_exist_at(
vec![
"yehuda.yaml",
"jonathan.json",
"jtjson",
"andres.xml",
"kevin.txt",
"many_more.ppl",

View File

@ -11,7 +11,7 @@ fn adds_row_data_if_column_missing() {
{
"amigos": [
{"name": "Yehuda"},
{"name": "Jonathan", "rusty_luck": 0},
{"name": "JT", "rusty_luck": 0},
{"name": "Andres", "rusty_luck": 0},
{"name":"GorbyPuff"}
]

View File

@ -10,7 +10,7 @@ fn knows_the_filesystems_entered() {
.within("red_pill")
.with_files(vec![
EmptyFile("andres.nu"),
EmptyFile("jonathan.nu"),
EmptyFile("jtnu"),
EmptyFile("yehuda.nu"),
])
.within("blue_pill")
@ -32,7 +32,7 @@ fn knows_the_filesystems_entered() {
enter expected
mkdir recycled
enter ../red_pill
mv jonathan.nu ../expected
mv jtnu ../expected
enter ../blue_pill
cp *.nxt ../expected/recycled
p
@ -54,7 +54,7 @@ fn knows_the_filesystems_entered() {
assert!(files_exist_at(
vec![
Path::new("andres.nu"),
Path::new("jonathan.nu"),
Path::new("jtnu"),
Path::new("yehuda.nu"),
],
expected

View File

@ -60,7 +60,7 @@ fn format_filesize_works() {
Playground::setup("format_filesize_test_1", |dirs, sandbox| {
sandbox.with_files(vec![
EmptyFile("yehuda.txt"),
EmptyFile("jonathan.txt"),
EmptyFile("jttxt"),
EmptyFile("andres.txt"),
]);

View File

@ -45,7 +45,7 @@ fn fetches_by_index() {
[package]
name = "nu"
version = "0.4.1"
authors = ["Yehuda Katz <wycats@gmail.com>", "Jonathan Turner <jonathan.d.turner@gmail.com>", "Andrés N. Robalino <andres@androbtech.com>"]
authors = ["Yehuda Katz <wycats@gmail.com>", "JT Turner <547158+jntrnr@users.noreply.github.com>", "Andrés N. Robalino <andres@androbtech.com>"]
description = "When arepas shells are tasty and fun."
"#,
)]);
@ -92,7 +92,7 @@ fn column_paths_are_either_double_quoted_or_regular_unquoted_words_separated_by_
"sample.toml",
r#"
[package]
9999 = ["Yehuda Katz <wycats@gmail.com>", "Jonathan Turner <jonathan.d.turner@gmail.com>", "Andrés N. Robalino <andres@androbtech.com>"]
9999 = ["Yehuda Katz <wycats@gmail.com>", "JT Turner <jtd.turner@gmail.com>", "Andrés N. Robalino <andres@androbtech.com>"]
description = "When arepas shells are tasty and fun."
"#,
)]);

View File

@ -7,7 +7,7 @@ fn empty_glob_pattern_triggers_error() {
Playground::setup("glob_test_1", |dirs, sandbox| {
sandbox.with_files(vec![
EmptyFile("yehuda.txt"),
EmptyFile("jonathan.txt"),
EmptyFile("jttxt"),
EmptyFile("andres.txt"),
]);
@ -25,7 +25,7 @@ fn nonempty_glob_lists_matching_paths() {
Playground::setup("glob_sanity_star", |dirs, sandbox| {
sandbox.with_files(vec![
EmptyFile("yehuda.txt"),
EmptyFile("jonathan.txt"),
EmptyFile("jttxt"),
EmptyFile("andres.txt"),
]);
@ -43,7 +43,7 @@ fn glob_subdirs() {
Playground::setup("glob_subdirs", |dirs, sandbox| {
sandbox.with_files(vec![
EmptyFile("yehuda.txt"),
EmptyFile("jonathan.txt"),
EmptyFile("jttxt"),
EmptyFile("andres.txt"),
]);
sandbox.mkdir("children");
@ -70,7 +70,7 @@ fn glob_subdirs_ignore_dirs() {
Playground::setup("glob_subdirs_ignore_directories", |dirs, sandbox| {
sandbox.with_files(vec![
EmptyFile("yehuda.txt"),
EmptyFile("jonathan.txt"),
EmptyFile("jttxt"),
EmptyFile("andres.txt"),
]);
sandbox.mkdir("children");
@ -97,7 +97,7 @@ fn glob_ignore_files() {
Playground::setup("glob_ignore_files", |dirs, sandbox| {
sandbox.with_files(vec![
EmptyFile("yehuda.txt"),
EmptyFile("jonathan.txt"),
EmptyFile("jttxt"),
EmptyFile("andres.txt"),
]);
sandbox.mkdir("children");

View File

@ -10,7 +10,7 @@ fn groups() {
r#"
first_name,last_name,rusty_at,type
Andrés,Robalino,10/11/2013,A
Jonathan,Turner,10/12/2013,B
JT,Turner,10/12/2013,B
Yehuda,Katz,10/11/2013,A
"#,
)]);
@ -39,7 +39,7 @@ fn errors_if_given_unknown_column_name() {
"nu": {
"committers": [
{"name": "Andrés N. Robalino"},
{"name": "Jonathan Turner"},
{"name": "JT Turner"},
{"name": "Yehuda Katz"}
],
"releases": [
@ -79,7 +79,7 @@ fn errors_if_block_given_evaluates_more_than_one_row() {
r#"
first_name,last_name,rusty_at,type
Andrés,Robalino,10/11/2013,A
Jonathan,Turner,10/12/2013,B
JT,Turner,10/12/2013,B
Yehuda,Katz,10/11/2013,A
"#,
)]);

View File

@ -10,7 +10,7 @@ fn summarizes_by_column_given() {
r#"
first_name,last_name,rusty_at
Andrés,Robalino,Ecuador
Jonathan,Turner,Estados Unidos
JT,Turner,Estados Unidos
Yehuda,Katz,Estados Unidos
"#,
)]);
@ -42,7 +42,7 @@ fn summarizes_by_column_given_with_normalize_percentage() {
r#"
first_name,last_name,rusty_at
Andrés,Robalino,Ecuador
Jonathan,Turner,Estados Unidos
JT,Turner,Estados Unidos
Yehuda,Katz,Estados Unidos
"#,
)]);
@ -71,7 +71,7 @@ fn summarizes_by_values() {
r#"
first_name,last_name,rusty_at
Andrés,Robalino,Ecuador
Jonathan,Turner,Estados Unidos
JT,Turner,Estados Unidos
Yehuda,Katz,Estados Unidos
"#,
)]);

View File

@ -7,7 +7,7 @@ fn lists_regular_files() {
Playground::setup("ls_test_1", |dirs, sandbox| {
sandbox.with_files(vec![
EmptyFile("yehuda.txt"),
EmptyFile("jonathan.txt"),
EmptyFile("jttxt"),
EmptyFile("andres.txt"),
]);
@ -50,7 +50,7 @@ fn lists_regular_files_using_question_mark_wildcard() {
Playground::setup("ls_test_3", |dirs, sandbox| {
sandbox.with_files(vec![
EmptyFile("yehuda.10.txt"),
EmptyFile("jonathan.10.txt"),
EmptyFile("jt.10.txt"),
EmptyFile("andres.10.txt"),
EmptyFile("chicken_not_to_be_picked_up.100.txt"),
]);
@ -73,10 +73,7 @@ fn lists_all_files_in_directories_from_stream() {
sandbox
.with_files(vec![EmptyFile("root1.txt"), EmptyFile("root2.txt")])
.within("dir_a")
.with_files(vec![
EmptyFile("yehuda.10.txt"),
EmptyFile("jonathan.10.txt"),
])
.with_files(vec![EmptyFile("yehuda.10.txt"), EmptyFile("jt10.txt")])
.within("dir_b")
.with_files(vec![
EmptyFile("andres.10.txt"),
@ -132,7 +129,7 @@ fn list_files_from_two_parents_up_using_multiple_dots() {
Playground::setup("ls_test_6", |dirs, sandbox| {
sandbox.with_files(vec![
EmptyFile("yahuda.yaml"),
EmptyFile("jonathan.json"),
EmptyFile("jtjson"),
EmptyFile("andres.xml"),
EmptyFile("kevin.txt"),
]);
@ -185,7 +182,7 @@ fn lists_all_hidden_files_when_glob_contains_dot() {
.within("dir_a")
.with_files(vec![
EmptyFile("yehuda.10.txt"),
EmptyFile("jonathan.10.txt"),
EmptyFile("jt10.txt"),
EmptyFile(".dotfile2"),
])
.within("dir_b")
@ -222,7 +219,7 @@ fn lists_all_hidden_files_when_glob_does_not_contain_dot() {
.within("dir_a")
.with_files(vec![
EmptyFile("yehuda.10.txt"),
EmptyFile("jonathan.10.txt"),
EmptyFile("jt10.txt"),
EmptyFile(".dotfile2"),
])
.within(".dir_b")
@ -284,10 +281,9 @@ fn glob_with_hidden_directory() {
#[cfg(unix)]
fn fails_with_ls_to_dir_without_permission() {
Playground::setup("ls_test_1", |dirs, sandbox| {
sandbox.within("dir_a").with_files(vec![
EmptyFile("yehuda.11.txt"),
EmptyFile("jonathan.10.txt"),
]);
sandbox
.within("dir_a")
.with_files(vec![EmptyFile("yehuda.11.txt"), EmptyFile("jt10.txt")]);
let actual = nu!(
cwd: dirs.test(), pipeline(
@ -317,7 +313,7 @@ fn lists_files_including_starting_with_dot() {
Playground::setup("ls_test_9", |dirs, sandbox| {
sandbox.with_files(vec![
EmptyFile("yehuda.txt"),
EmptyFile("jonathan.txt"),
EmptyFile("jttxt"),
EmptyFile("andres.txt"),
EmptyFile(".hidden1.txt"),
EmptyFile(".hidden2.txt"),

View File

@ -11,7 +11,7 @@ fn row() {
r#"
name,country,luck
Andrés,Ecuador,0
Jonathan,USA,0
JT,USA,0
Jason,Canada,0
Yehuda,USA,0
"#,
@ -21,7 +21,7 @@ fn row() {
r#"
name,country,luck
Andrés Robalino,Guayaquil Ecuador,1
Jonathan Turner,New Zealand,1
JT Turner,New Zealand,1
"#,
),
]);

View File

@ -45,10 +45,7 @@ fn moves_columns_before() {
-------,-------, D ,---,--------, R ,---------
-------,-------, E ,---,--------, S ,---------
-------,-------, : ,---,--------, : ,---------
-------,-------, J ,---,--------, O ,---------
-------,-------, N ,---,--------, A ,---------
-------,-------, T ,---,--------, H ,---------
-------,-------, A ,---,--------, N ,---------
-------,-------, J ,---,--------, T ,---------
"#,
)]);
@ -65,7 +62,7 @@ fn moves_columns_before() {
"#
));
assert!(actual.out.contains("ANDRES::JONATHAN"));
assert!(actual.out.contains("ANDRES::JT"));
})
}
@ -80,10 +77,7 @@ fn moves_a_column_after() {
-------,-------, D ,---,--------, R ,---------
-------,-------, E ,---,--------, S ,---------
-------,-------, : ,---,--------, : ,---------
-------,-------, J ,---,--------, O ,---------
-------,-------, N ,---,--------, A ,---------
-------,-------, T ,---,--------, H ,---------
-------,-------, A ,---,--------, N ,---------
-------,-------, J ,---,--------, T ,---------
"#,
)]);
@ -101,7 +95,7 @@ fn moves_a_column_after() {
"#
));
assert!(actual.out.contains("ANDRES::JONATHAN"));
assert!(actual.out.contains("ANDRES::JT"));
})
}
@ -116,10 +110,7 @@ fn moves_columns_after() {
-------,-------, D ,---,--------, R ,---------
-------,-------, E ,---,--------, S ,---------
-------,-------, : ,---,--------, : ,---------
-------,-------, J ,---,--------, O ,---------
-------,-------, N ,---,--------, A ,---------
-------,-------, T ,---,--------, H ,---------
-------,-------, A ,---,--------, N ,---------
-------,-------, J ,---,--------, T ,---------
"#,
)]);

View File

@ -25,14 +25,14 @@ fn moves_a_file() {
#[test]
fn overwrites_if_moving_to_existing_file_and_force_provided() {
Playground::setup("mv_test_2", |dirs, sandbox| {
sandbox.with_files(vec![EmptyFile("andres.txt"), EmptyFile("jonathan.txt")]);
sandbox.with_files(vec![EmptyFile("andres.txt"), EmptyFile("jttxt")]);
let original = dirs.test().join("andres.txt");
let expected = dirs.test().join("jonathan.txt");
let expected = dirs.test().join("jttxt");
nu!(
cwd: dirs.test(),
"mv andres.txt -f jonathan.txt"
"mv andres.txt -f jttxt"
);
assert!(!original.exists());
@ -62,15 +62,15 @@ fn moves_a_directory() {
fn moves_the_file_inside_directory_if_path_to_move_is_existing_directory() {
Playground::setup("mv_test_4", |dirs, sandbox| {
sandbox
.with_files(vec![EmptyFile("jonathan.txt")])
.with_files(vec![EmptyFile("jttxt")])
.mkdir("expected");
let original_dir = dirs.test().join("jonathan.txt");
let expected = dirs.test().join("expected/jonathan.txt");
let original_dir = dirs.test().join("jttxt");
let expected = dirs.test().join("expected/jttxt");
nu!(
cwd: dirs.test(),
"mv jonathan.txt expected"
"mv jttxt expected"
);
assert!(!original_dir.exists());
@ -83,7 +83,7 @@ fn moves_the_directory_inside_directory_if_path_to_move_is_existing_directory()
Playground::setup("mv_test_5", |dirs, sandbox| {
sandbox
.within("contributors")
.with_files(vec![EmptyFile("jonathan.txt")])
.with_files(vec![EmptyFile("jttxt")])
.mkdir("expected");
let original_dir = dirs.test().join("contributors");
@ -96,7 +96,7 @@ fn moves_the_directory_inside_directory_if_path_to_move_is_existing_directory()
assert!(!original_dir.exists());
assert!(expected.exists());
assert!(files_exist_at(vec!["jonathan.txt"], expected))
assert!(files_exist_at(vec!["jttxt"], expected))
})
}
@ -109,8 +109,8 @@ fn moves_using_path_with_wildcard() {
EmptyFile("andres.ini"),
EmptyFile("caco3_plastics.csv"),
EmptyFile("cargo_sample.toml"),
EmptyFile("jonathan.ini"),
EmptyFile("jonathan.xml"),
EmptyFile("jt.ini"),
EmptyFile("jt.xml"),
EmptyFile("sgml_description.json"),
EmptyFile("sample.ini"),
EmptyFile("utf16.ini"),
@ -125,7 +125,7 @@ fn moves_using_path_with_wildcard() {
nu!(cwd: work_dir, "mv ../originals/*.ini ../expected");
assert!(files_exist_at(
vec!["yehuda.ini", "jonathan.ini", "sample.ini", "andres.ini",],
vec!["yehuda.ini", "jt.ini", "sample.ini", "andres.ini",],
expected
));
})
@ -210,11 +210,11 @@ fn errors_if_source_doesnt_exist() {
#[test]
fn error_if_moving_to_existing_file_without_force() {
Playground::setup("mv_test_10_0", |dirs, sandbox| {
sandbox.with_files(vec![EmptyFile("andres.txt"), EmptyFile("jonathan.txt")]);
sandbox.with_files(vec![EmptyFile("andres.txt"), EmptyFile("jttxt")]);
let actual = nu!(
cwd: dirs.test(),
"mv andres.txt jonathan.txt"
"mv andres.txt jttxt"
);
assert!(actual.err.contains("file already exists"))
})
@ -309,7 +309,7 @@ fn does_not_error_on_relative_parent_path() {
fn move_files_using_glob_two_parents_up_using_multiple_dots() {
Playground::setup("mv_test_12", |dirs, sandbox| {
sandbox.within("foo").within("bar").with_files(vec![
EmptyFile("jonathan.json"),
EmptyFile("jtjson"),
EmptyFile("andres.xml"),
EmptyFile("yehuda.yaml"),
EmptyFile("kevin.txt"),
@ -325,7 +325,7 @@ fn move_files_using_glob_two_parents_up_using_multiple_dots() {
let files = vec![
"yehuda.yaml",
"jonathan.json",
"jtjson",
"andres.xml",
"kevin.txt",
"many_more.ppl",

View File

@ -10,7 +10,7 @@ fn parses_csv() {
"nu.zion.csv",
r#"
author,lang,source
Jonathan Turner,Rust,New Zealand
JT Turner,Rust,New Zealand
Andres N. Robalino,Rust,Ecuador
Yehuda Katz,Rust,Estados Unidos
"#,
@ -180,7 +180,7 @@ fn parses_xml() {
let actual = nu!(
cwd: "tests/fixtures/formats",
pipeline(r#"
open jonathan.xml
open jt.xml
| get content
| where tag == channel
| get content
@ -193,10 +193,7 @@ fn parses_xml() {
"#)
);
assert_eq!(
actual.out,
"http://www.jonathanturner.org/2015/10/off-to-new-adventures.html"
)
assert_eq!(actual.out, "https://www.jntrnr.com/off-to-new-adventures/")
}
#[cfg(feature = "dataframe")]
@ -242,7 +239,7 @@ fn open_dir_is_ls() {
Playground::setup("open_dir", |dirs, sandbox| {
sandbox.with_files(vec![
EmptyFile("yehuda.txt"),
EmptyFile("jonathan.txt"),
EmptyFile("jttxt"),
EmptyFile("andres.txt"),
]);

View File

@ -12,7 +12,7 @@ mod simple {
"key_value_separated_arepa_ingredients.txt",
r#"
VAR1=Cheese
VAR2=JonathanParsed
VAR2=JTParsed
VAR3=NushellSecretIngredient
"#,
)]);
@ -29,7 +29,7 @@ mod simple {
"#
));
assert_eq!(actual.out, "JonathanParsed");
assert_eq!(actual.out, "JTParsed");
})
}

View File

@ -9,7 +9,7 @@ fn adds_a_row_to_the_beginning() {
"los_tres_caballeros.txt",
r#"
Andrés N. Robalino
Jonathan Turner
JT Turner
Yehuda Katz
"#,
)]);

View File

@ -8,7 +8,7 @@ fn regular_columns() {
[first_name, last_name, rusty_at, type];
[Andrés Robalino 10/11/2013 A]
[Jonathan Turner 10/12/2013 B]
[JT Turner 10/12/2013 B]
[Yehuda Katz 10/11/2013 A]
]
| reject type first_name
@ -36,7 +36,7 @@ fn complex_nested_columns() {
"nu": {
"committers": [
{"name": "Andrés N. Robalino"},
{"name": "Jonathan Turner"},
{"name": "JT Turner"},
{"name": "Yehuda Katz"}
],
"releases": [

View File

@ -9,7 +9,7 @@ fn changes_the_column_name() {
"los_cuatro_mosqueteros.txt",
r#"
Andrés N. Robalino
Jonathan Turner
JT Turner
Yehuda Katz
Jason Gedge
"#,
@ -38,7 +38,7 @@ fn keeps_remaining_original_names_given_less_new_names_than_total_original_names
"los_cuatro_mosqueteros.txt",
r#"
Andrés N. Robalino
Jonathan Turner
JT Turner
Yehuda Katz
Jason Gedge
"#,
@ -68,7 +68,7 @@ fn errors_if_no_columns_present() {
"los_cuatro_mosqueteros.txt",
r#"
Andrés N. Robalino
Jonathan Turner
JT Turner
Yehuda Katz
Jason Gedge
"#,
@ -94,7 +94,7 @@ fn errors_if_columns_param_is_empty() {
"los_cuatro_mosqueteros.txt",
r#"
Andrés N. Robalino
Jonathan Turner
JT Turner
Yehuda Katz
Jason Gedge
"#,

View File

@ -108,7 +108,7 @@ fn removes_directory_contents_with_recursive_flag() {
Playground::setup("rm_test_5", |dirs, sandbox| {
sandbox.with_files(vec![
EmptyFile("yehuda.txt"),
EmptyFile("jonathan.txt"),
EmptyFile("jttxt"),
EmptyFile("andres.txt"),
]);
@ -187,13 +187,13 @@ fn removes_multiple_files() {
Playground::setup("rm_test_10", |dirs, sandbox| {
sandbox.with_files(vec![
EmptyFile("yehuda.txt"),
EmptyFile("jonathan.txt"),
EmptyFile("jttxt"),
EmptyFile("andres.txt"),
]);
nu!(
cwd: dirs.test(),
"rm yehuda.txt jonathan.txt andres.txt"
"rm yehuda.txt jttxt andres.txt"
);
assert_eq!(
@ -208,7 +208,7 @@ fn removes_multiple_files_with_asterisks() {
Playground::setup("rm_test_11", |dirs, sandbox| {
sandbox.with_files(vec![
EmptyFile("yehuda.txt"),
EmptyFile("jonathan.txt"),
EmptyFile("jt.txt"),
EmptyFile("andres.toml"),
]);
@ -227,7 +227,7 @@ fn removes_multiple_files_with_asterisks() {
#[test]
fn allows_doubly_specified_file() {
Playground::setup("rm_test_12", |dirs, sandbox| {
sandbox.with_files(vec![EmptyFile("yehuda.txt"), EmptyFile("jonathan.toml")]);
sandbox.with_files(vec![EmptyFile("yehuda.txt"), EmptyFile("jt.toml")]);
let actual = nu!(
cwd: dirs.test(),
@ -247,7 +247,7 @@ fn remove_files_from_two_parents_up_using_multiple_dots_and_glob() {
Playground::setup("rm_test_13", |dirs, sandbox| {
sandbox.with_files(vec![
EmptyFile("yehuda.txt"),
EmptyFile("jonathan.txt"),
EmptyFile("jt.txt"),
EmptyFile("kevin.txt"),
]);
@ -259,7 +259,7 @@ fn remove_files_from_two_parents_up_using_multiple_dots_and_glob() {
);
assert!(!files_exist_at(
vec!["yehuda.txt", "jonathan.txt", "kevin.txt"],
vec!["yehuda.txt", "jttxt", "kevin.txt"],
dirs.test()
));
})

View File

@ -55,7 +55,7 @@ mod columns {
[ "Andres", EC, amarillito]
[ "Darren", US, black]
[ "Jonathan", US, black]
[ "JT", US, black]
[ "Yehuda", US, black]
[ "Jason", CA, gold]
]"#,

View File

@ -10,7 +10,7 @@ fn regular_columns() {
[first_name, last_name, rusty_at, type];
[Andrés Robalino 10/11/2013 A]
[Jonathan Turner 10/12/2013 B]
[JT Turner 10/12/2013 B]
[Yehuda Katz 10/11/2013 A]
]
| select rusty_at last_name
@ -32,7 +32,7 @@ fn complex_nested_columns() {
"nu": {
"committers": [
{"name": "Andrés N. Robalino"},
{"name": "Jonathan Turner"},
{"name": "JT Turner"},
{"name": "Yehuda Katz"}
],
"releases": [
@ -73,7 +73,7 @@ fn fails_if_given_unknown_column_name() {
[first_name, last_name, rusty_at, type];
[Andrés Robalino 10/11/2013 A]
[Jonathan Turner 10/12/2013 B]
[JT Turner 10/12/2013 B]
[Yehuda Katz 10/11/2013 A]
]
| select rrusty_at first_name

View File

@ -13,17 +13,17 @@ fn condition_is_met() {
Chicken Collection,29/04/2020,30/04/2020,31/04/2020
Yellow Chickens,,,
Andrés,0,0,1
Jonathan,0,0,1
JT,0,0,1
Jason,0,0,1
Yehuda,0,0,1
Blue Chickens,,,
Andrés,0,0,1
Jonathan,0,0,1
JT,0,0,1
Jason,0,0,1
Yehuda,0,0,2
Red Chickens,,,
Andrés,0,0,1
Jonathan,0,0,1
JT,0,0,1
Jason,0,0,1
Yehuda,0,0,3
"#,

View File

@ -13,17 +13,17 @@ fn condition_is_met() {
Chicken Collection,29/04/2020,30/04/2020,31/04/2020
Yellow Chickens,,,
Andrés,0,0,1
Jonathan,0,0,1
JT,0,0,1
Jason,0,0,1
Yehuda,0,0,1
Blue Chickens,,,
Andrés,0,0,1
Jonathan,0,0,1
JT,0,0,1
Jason,0,0,1
Yehuda,0,0,2
Red Chickens,,,
Andrés,0,0,1
Jonathan,0,0,1
JT,0,0,1
Jason,0,0,1
Yehuda,0,0,3
"#,

View File

@ -10,7 +10,7 @@ fn splits() {
r#"
first_name,last_name,rusty_at,type
Andrés,Robalino,10/11/2013,A
Jonathan,Turner,10/12/2013,B
JT,Turner,10/12/2013,B
Yehuda,Katz,10/11/2013,A
"#,
)]);

View File

@ -10,7 +10,7 @@ fn rows() {
r#"
name,lucky_code
Andrés,1
Jonathan,1
JT,1
Jason,2
Yehuda,1
"#,

View File

@ -13,17 +13,17 @@ fn condition_is_met() {
Chicken Collection,29/04/2020,30/04/2020,31/04/2020
Yellow Chickens,,,
Andrés,1,1,1
Jonathan,1,1,1
JT,1,1,1
Jason,1,1,1
Yehuda,1,1,1
Blue Chickens,,,
Andrés,1,1,2
Jonathan,1,1,2
JT,1,1,2
Jason,1,1,2
Yehuda,1,1,2
Red Chickens,,,
Andrés,1,1,3
Jonathan,1,1,3
JT,1,1,3
Jason,1,1,3
Yehuda,1,1,3
"#,

View File

@ -13,17 +13,17 @@ fn condition_is_met() {
Chicken Collection,29/04/2020,30/04/2020,31/04/2020
Yellow Chickens,,,
Andrés,1,1,1
Jonathan,1,1,1
JT,1,1,1
Jason,1,1,1
Yehuda,1,1,1
Blue Chickens,,,
Andrés,1,1,2
Jonathan,1,1,2
JT,1,1,2
Jason,1,1,2
Yehuda,1,1,2
Red Chickens,,,
Andrés,1,1,3
Jonathan,1,1,3
JT,1,1,3
Jason,1,1,3
Yehuda,1,1,3
"#,

View File

@ -10,9 +10,9 @@ fn removes_duplicate_rows() {
r#"
first_name,last_name,rusty_at,type
Andrés,Robalino,10/11/2013,A
Jonathan,Turner,10/12/2013,B
JT,Turner,10/12/2013,B
Yehuda,Katz,10/11/2013,A
Jonathan,Turner,10/12/2013,B
JT,Turner,10/12/2013,B
Yehuda,Katz,10/11/2013,A
"#,
)]);
@ -39,9 +39,9 @@ fn uniq_values() {
r#"
first_name,last_name,rusty_at,type
Andrés,Robalino,10/11/2013,A
Jonathan,Turner,10/12/2013,B
JT,Turner,10/12/2013,B
Yehuda,Katz,10/11/2013,A
Jonathan,Turner,10/12/2013,B
JT,Turner,10/12/2013,B
Yehuda,Katz,10/11/2013,A
"#,
)]);

View File

@ -12,7 +12,7 @@ fn removes_duplicate_rows() {
Andrés,Robalino,10/11/2013,A
Afonso,Turner,10/12/2013,B
Yehuda,Katz,10/11/2013,A
Jonathan,Turner,11/12/2011,O
JT,Turner,11/12/2011,O
"#,
)]);

View File

@ -10,7 +10,7 @@ fn wrap_rows_into_a_row() {
r#"
first_name,last_name
Andrés,Robalino
Jonathan,Turner
JT,Turner
Yehuda,Katz
"#,
)]);
@ -39,7 +39,7 @@ fn wrap_rows_into_a_table() {
r#"
first_name,last_name
Andrés,Robalino
Jonathan,Turner
JT,Turner
Yehuda,Katz
"#,
)]);

View File

@ -82,7 +82,7 @@ fn infers_types() {
r#"
first_name,last_name,rusty_luck,d
Andrés,Robalino,1,d
Jonathan,Turner,1,d
JT,Turner,1,d
Yehuda,Katz,1,d
Jason,Gedge,1,d
"#,
@ -109,7 +109,7 @@ fn from_csv_text_to_table() {
r#"
first_name,last_name,rusty_luck
Andrés,Robalino,1
Jonathan,Turner,1
JT,Turner,1
Yehuda,Katz,1
"#,
)]);
@ -136,7 +136,7 @@ fn from_csv_text_with_separator_to_table() {
r#"
first_name;last_name;rusty_luck
Andrés;Robalino;1
Jonathan;Turner;1
JT;Turner;1
Yehuda;Katz;1
"#,
)]);
@ -163,7 +163,7 @@ fn from_csv_text_with_tab_separator_to_table() {
r#"
first_name last_name rusty_luck
Andrés Robalino 1
Jonathan Turner 1
JT Turner 1
Yehuda Katz 1
"#,
)]);
@ -189,7 +189,7 @@ fn from_csv_text_skipping_headers_to_table() {
"los_tres_amigos.txt",
r#"
Andrés,Robalino,1
Jonathan,Turner,1
JT,Turner,1
Yehuda,Katz,1
"#,
)]);

View File

@ -26,7 +26,7 @@ fn from_json_text_to_table() {
{
"katz": [
{"name": "Yehuda", "rusty_luck": 1},
{"name": "Jonathan", "rusty_luck": 1},
{"name": "JT", "rusty_luck": 1},
{"name": "Andres", "rusty_luck": 1},
{"name":"GorbyPuff", "rusty_luck": 1}
]
@ -50,7 +50,7 @@ fn from_json_text_recognizing_objects_independently_to_table() {
"katz.txt",
r#"
{"name": "Yehuda", "rusty_luck": 1}
{"name": "Jonathan", "rusty_luck": 1}
{"name": "JT", "rusty_luck": 1}
{"name": "Andres", "rusty_luck": 1}
{"name":"GorbyPuff", "rusty_luck": 3}
"#,

View File

@ -86,7 +86,7 @@ fn from_tsv_text_to_table() {
r#"
first Name Last Name rusty_luck
Andrés Robalino 1
Jonathan Turner 1
JT Turner 1
Yehuda Katz 1
"#,
)]);
@ -112,7 +112,7 @@ fn from_tsv_text_skipping_headers_to_table() {
"los_tres_amigos.txt",
r#"
Andrés Robalino 1
Jonathan Turner 1
JT Turner 1
Yehuda Katz 1
"#,
)]);

View File

@ -5,7 +5,7 @@ fn table_to_xml_text_and_from_xml_text_back_into_table() {
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
r#"
open jonathan.xml
open jt.xml
| to xml
| from xml
| get content

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Jonathan Turner</title>
<link>http://www.jonathanturner.org</link>
<atom:link href="http://www.jonathanturner.org/feed.xml" rel="self" type="application/rss+xml" />
<title>JT</title>
<link>http://www.jntrnr.com</link>
<atom:link href="https://www.jntrnr.com/atom.xml" rel="self" type="application/rss+xml" />
<item>
<title>Creating crossplatform Rust terminal apps</title>
@ -14,8 +14,8 @@
&lt;p&gt;Part of the adventure is not seeing the way ahead and going anyway.&lt;/p&gt;
</description>
<pubDate>Mon, 05 Oct 2015 00:00:00 +0000</pubDate>
<link>http://www.jonathanturner.org/2015/10/off-to-new-adventures.html</link>
<guid isPermaLink="true">http://www.jonathanturner.org/2015/10/off-to-new-adventures.html</guid>
<link>https://www.jntrnr.com/off-to-new-adventures/</link>
<guid isPermaLink="true">https://www.jntrnr.com/off-to-new-adventures/</guid>
</item>
</channel>

View File

@ -148,7 +148,7 @@ mod it_evaluation {
fn takes_rows_of_nu_value_strings() {
Playground::setup("it_argument_test_1", |dirs, sandbox| {
sandbox.with_files(vec![
EmptyFile("jonathan_likes_cake.txt"),
EmptyFile("jt_likes_cake.txt"),
EmptyFile("andres_likes_arepas.txt"),
]);
@ -163,7 +163,7 @@ mod it_evaluation {
"#
));
assert_eq!(actual.out, "jonathan_likes_cake.txt");
assert_eq!(actual.out, "jt_likes_cake.txt");
})
}
@ -436,7 +436,7 @@ mod external_command_arguments {
"expands_table_of_primitives_to_positional_arguments",
|dirs, sandbox| {
sandbox.with_files(vec![
EmptyFile("jonathan_likes_cake.txt"),
EmptyFile("jt_likes_cake.txt"),
EmptyFile("andres_likes_arepas.txt"),
EmptyFile("ferris_not_here.txt"),
]);
@ -450,7 +450,7 @@ mod external_command_arguments {
assert_eq!(
actual.out,
"andres_likes_arepas.txt ferris_not_here.txt jonathan_likes_cake.txt"
"andres_likes_arepas.txt ferris_not_here.txt jt_likes_cake.txt"
);
},
)
@ -462,7 +462,7 @@ mod external_command_arguments {
"expands_table_of_primitives_to_positional_arguments",
|dirs, sandbox| {
sandbox.with_files(vec![
EmptyFile("jonathan_likes_cake.txt"),
EmptyFile("jt_likes_cake.txt"),
EmptyFile("andres_likes_arepas.txt"),
EmptyFile("ferris_not_here.txt"),
]);

View File

@ -11,7 +11,7 @@ fn takes_rows_of_nu_value_strings_and_pipes_it_to_stdin_of_external() {
r#"
name,rusty_luck,origin
Jason,1,Canada
Jonathan,1,New Zealand
JT,1,New Zealand
Andrés,1,Ecuador
AndKitKatz,1,Estados Unidos
"#,
@ -103,7 +103,7 @@ fn subexpression_handles_dot() {
r#"
name,rusty_luck,origin
Jason,1,Canada
Jonathan,1,New Zealand
JT,1,New Zealand
Andrés,1,Ecuador
AndKitKatz,1,Estados Unidos
"#,