fix some typos (#7773)

# Description

Nothing changed, just fix some typos

# 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

# 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.

Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
This commit is contained in:
Justin Ma 2023-01-16 19:43:46 +08:00 committed by GitHub
parent 26e6516626
commit f823c7cb5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 36 additions and 36 deletions

View File

@ -76,7 +76,7 @@ fn filesystem_switch_back_to_previous_working_directory() {
// FIXME: jt: needs more work // FIXME: jt: needs more work
#[ignore] #[ignore]
#[test] #[test]
fn filesytem_change_from_current_directory_using_relative_path_and_dash() { fn filesystem_change_from_current_directory_using_relative_path_and_dash() {
Playground::setup("cd_test_4", |dirs, sandbox| { Playground::setup("cd_test_4", |dirs, sandbox| {
sandbox.within("odin").mkdir("-"); sandbox.within("odin").mkdir("-");
@ -292,7 +292,7 @@ fn test_change_windows_drive() {
#[cfg(unix)] #[cfg(unix)]
#[test] #[test]
fn cd_permission_deined_folder() { fn cd_permission_denied_folder() {
Playground::setup("cd_test_21", |dirs, sandbox| { Playground::setup("cd_test_21", |dirs, sandbox| {
sandbox.mkdir("banned"); sandbox.mkdir("banned");
let actual = nu!( let actual = nu!(
@ -312,11 +312,11 @@ fn cd_permission_deined_folder() {
); );
}); });
} }
// FIXME: cd_permission_deined_folder on windows // FIXME: cd_permission_denied_folder on windows
#[ignore] #[ignore]
#[cfg(windows)] #[cfg(windows)]
#[test] #[test]
fn cd_permission_deined_folder() { fn cd_permission_denied_folder() {
Playground::setup("cd_test_21", |dirs, sandbox| { Playground::setup("cd_test_21", |dirs, sandbox| {
sandbox.mkdir("banned"); sandbox.mkdir("banned");
let actual = nu!( let actual = nu!(

View File

@ -41,7 +41,7 @@ fn catch_can_access_error_as_dollar_in() {
} }
#[test] #[test]
fn external_failed_should_be_catched() { fn external_failed_should_be_caught() {
let output = nu!( let output = nu!(
cwd: ".", cwd: ".",
"try { nu --testbin fail; echo 'success' } catch { echo 'fail' }" "try { nu --testbin fail; echo 'success' } catch { echo 'fail' }"
@ -66,7 +66,7 @@ fn loop_catch_break_should_show_failed() {
cwd: ".", cwd: ".",
"loop { "loop {
try { invalid 1; try { invalid 1;
continue; } catch { echo 'failed'; break } continue; } catch { echo 'failed'; break }
} }
" "
); );
@ -80,10 +80,10 @@ fn loop_try_ignores_continue() {
cwd: ".", cwd: ".",
"mut total = 0; "mut total = 0;
for i in 0..10 { for i in 0..10 {
try { if ($i mod 2) == 0 { try { if ($i mod 2) == 0 {
continue;} continue;}
$total += 1 $total += 1
} catch { echo 'failed'; break } } catch { echo 'failed'; break }
} }
echo $total echo $total
" "

View File

@ -115,11 +115,11 @@ pub fn create_commands(registry: &mut CommandRegistry) {
registry.register_command_reactive(TweakCmd::default()); registry.register_command_reactive(TweakCmd::default());
} }
pub fn create_aliases(regestry: &mut CommandRegistry) { pub fn create_aliases(registry: &mut CommandRegistry) {
regestry.create_aliase("h", HelpCmd::NAME); registry.create_aliases("h", HelpCmd::NAME);
regestry.create_aliase("e", ExpandCmd::NAME); registry.create_aliases("e", ExpandCmd::NAME);
regestry.create_aliase("q", QuitCmd::NAME); registry.create_aliases("q", QuitCmd::NAME);
regestry.create_aliase("q!", QuitCmd::NAME); registry.create_aliases("q!", QuitCmd::NAME);
} }
#[rustfmt::skip] #[rustfmt::skip]

View File

@ -46,7 +46,7 @@ impl CommandRegistry {
); );
} }
pub fn create_aliase(&mut self, aliases: &str, command: &str) { pub fn create_aliases(&mut self, aliases: &str, command: &str) {
self.aliases.insert( self.aliases.insert(
Cow::Owned(aliases.to_owned()), Cow::Owned(aliases.to_owned()),
Cow::Owned(command.to_owned()), Cow::Owned(command.to_owned()),

View File

@ -18,7 +18,7 @@ use super::{coloredtextw::ColoredTextW, cursor::XYCursor, Layout, View, ViewConf
// todo: Add wrap option // todo: Add wrap option
#[derive(Debug)] #[derive(Debug)]
pub struct Preview { pub struct Preview {
underlaying_value: Option<Value>, underlying_value: Option<Value>,
lines: Vec<String>, lines: Vec<String>,
cursor: XYCursor, cursor: XYCursor,
} }
@ -34,12 +34,12 @@ impl Preview {
Self { Self {
lines, lines,
cursor, cursor,
underlaying_value: None, underlying_value: None,
} }
} }
pub fn set_value(&mut self, value: Value) { pub fn set_value(&mut self, value: Value) {
self.underlaying_value = Some(value); self.underlying_value = Some(value);
} }
} }
@ -147,7 +147,7 @@ impl View for Preview {
} }
fn exit(&mut self) -> Option<Value> { fn exit(&mut self) -> Option<Value> {
match &self.underlaying_value { match &self.underlying_value {
Some(value) => Some(value.clone()), Some(value) => Some(value.clone()),
None => { None => {
let text = self.lines.join("\n"); let text = self.lines.join("\n");

View File

@ -1268,7 +1268,7 @@ mod input_types {
} }
} }
fn add_declations(engine_state: &mut EngineState) { fn add_declarations(engine_state: &mut EngineState) {
let delta = { let delta = {
let mut working_set = StateWorkingSet::new(engine_state); let mut working_set = StateWorkingSet::new(engine_state);
working_set.add_decl(Box::new(Let)); working_set.add_decl(Box::new(Let));
@ -1293,7 +1293,7 @@ mod input_types {
#[test] #[test]
fn call_types_test() { fn call_types_test() {
let mut engine_state = EngineState::new(); let mut engine_state = EngineState::new();
add_declations(&mut engine_state); add_declarations(&mut engine_state);
let mut working_set = StateWorkingSet::new(&engine_state); let mut working_set = StateWorkingSet::new(&engine_state);
let input = r#"ls | to-custom | group-by name other"#; let input = r#"ls | to-custom | group-by name other"#;
@ -1356,7 +1356,7 @@ mod input_types {
#[test] #[test]
fn storing_variable_test() { fn storing_variable_test() {
let mut engine_state = EngineState::new(); let mut engine_state = EngineState::new();
add_declations(&mut engine_state); add_declarations(&mut engine_state);
let mut working_set = StateWorkingSet::new(&engine_state); let mut working_set = StateWorkingSet::new(&engine_state);
let input = let input =
@ -1388,7 +1388,7 @@ mod input_types {
#[test] #[test]
fn stored_variable_operation_test() { fn stored_variable_operation_test() {
let mut engine_state = EngineState::new(); let mut engine_state = EngineState::new();
add_declations(&mut engine_state); add_declarations(&mut engine_state);
let mut working_set = StateWorkingSet::new(&engine_state); let mut working_set = StateWorkingSet::new(&engine_state);
let input = r#"let a = (ls | to-custom | group-by name other); ($a + $a) | agg sum"#; let input = r#"let a = (ls | to-custom | group-by name other); ($a + $a) | agg sum"#;
@ -1419,7 +1419,7 @@ mod input_types {
#[test] #[test]
fn multiple_stored_variable_test() { fn multiple_stored_variable_test() {
let mut engine_state = EngineState::new(); let mut engine_state = EngineState::new();
add_declations(&mut engine_state); add_declarations(&mut engine_state);
let mut working_set = StateWorkingSet::new(&engine_state); let mut working_set = StateWorkingSet::new(&engine_state);
let input = r#" let input = r#"
@ -1464,7 +1464,7 @@ mod input_types {
#[test] #[test]
fn call_non_custom_types_test() { fn call_non_custom_types_test() {
let mut engine_state = EngineState::new(); let mut engine_state = EngineState::new();
add_declations(&mut engine_state); add_declarations(&mut engine_state);
let mut working_set = StateWorkingSet::new(&engine_state); let mut working_set = StateWorkingSet::new(&engine_state);
let input = r#"ls | group-by name"#; let input = r#"ls | group-by name"#;
@ -1509,7 +1509,7 @@ mod input_types {
#[test] #[test]
fn nested_operations_test() { fn nested_operations_test() {
let mut engine_state = EngineState::new(); let mut engine_state = EngineState::new();
add_declations(&mut engine_state); add_declarations(&mut engine_state);
let (block, delta) = { let (block, delta) = {
let mut working_set = StateWorkingSet::new(&engine_state); let mut working_set = StateWorkingSet::new(&engine_state);
@ -1570,7 +1570,7 @@ mod input_types {
#[test] #[test]
fn call_with_list_test() { fn call_with_list_test() {
let mut engine_state = EngineState::new(); let mut engine_state = EngineState::new();
add_declations(&mut engine_state); add_declarations(&mut engine_state);
let mut working_set = StateWorkingSet::new(&engine_state); let mut working_set = StateWorkingSet::new(&engine_state);
let input = r#"[[a b]; [1 2] [3 4]] | to-custom | with-column [ ("a" | min) ("b" | min) ] | collect"#; let input = r#"[[a b]; [1 2] [3 4]] | to-custom | with-column [ ("a" | min) ("b" | min) ] | collect"#;
@ -1617,7 +1617,7 @@ mod input_types {
#[test] #[test]
fn operations_within_blocks_test() { fn operations_within_blocks_test() {
let mut engine_state = EngineState::new(); let mut engine_state = EngineState::new();
add_declations(&mut engine_state); add_declarations(&mut engine_state);
let mut working_set = StateWorkingSet::new(&engine_state); let mut working_set = StateWorkingSet::new(&engine_state);
let inputs = vec![ let inputs = vec![
@ -1639,7 +1639,7 @@ mod input_types {
#[test] #[test]
fn else_errors_correctly() { fn else_errors_correctly() {
let mut engine_state = EngineState::new(); let mut engine_state = EngineState::new();
add_declations(&mut engine_state); add_declarations(&mut engine_state);
let mut working_set = StateWorkingSet::new(&engine_state); let mut working_set = StateWorkingSet::new(&engine_state);
let (_, err) = parse( let (_, err) = parse(

View File

@ -282,7 +282,7 @@ impl PipelineData {
} }
} }
/// Retrieves string from pipline data. /// Retrieves string from pipeline data.
/// ///
/// As opposed to `collect_string` this raises error rather than converting non-string values. /// As opposed to `collect_string` this raises error rather than converting non-string values.
/// The `span` will be used if `ListStream` is encountered since it doesn't carry a span. /// The `span` will be used if `ListStream` is encountered since it doesn't carry a span.

View File

@ -183,7 +183,7 @@ fn truncate_with_suffix_test() {
} }
#[test] #[test]
fn width_controll_test_0() { fn width_control_test_0() {
let data = vec![ let data = vec![
vec![_str("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); 16], vec![_str("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); 16],
vec![_str("yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"); 16], vec![_str("yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"); 16],

View File

@ -61,7 +61,7 @@ fn query_contains_modifiers(query: &str) -> bool {
// @pretty: Make the json document more human readable. // @pretty: Make the json document more human readable.
query.contains("@ugly") || query.contains("@pretty") query.contains("@ugly") || query.contains("@pretty")
// Output as Tablular // Output as Tabular
// Since it's output as tabular, which is our default, we can just ignore these // Since it's output as tabular, which is our default, we can just ignore these
// @reverse: Reverse an array or the members of an object. // @reverse: Reverse an array or the members of an object.
// @this: Returns the current element. It can be used to retrieve the root element. // @this: Returns the current element. It can be used to retrieve the root element.

View File

@ -305,7 +305,7 @@ fn given_a_trusted_directory_with_exit_scripts_when_entering_a_subdirectory_exit
#[test] #[test]
#[serial] #[serial]
fn given_a_hierachy_of_trusted_directories_when_entering_in_any_nested_ones_should_carry_over_variables_set_from_the_root( fn given_a_hierarchy_of_trusted_directories_when_entering_in_any_nested_ones_should_carry_over_variables_set_from_the_root(
) { ) {
Playground::setup("autoenv_test_9", |dirs, sandbox| { Playground::setup("autoenv_test_9", |dirs, sandbox| {
sandbox.mkdir("nu_plugin_rb"); sandbox.mkdir("nu_plugin_rb");
@ -336,7 +336,7 @@ fn given_a_hierachy_of_trusted_directories_when_entering_in_any_nested_ones_shou
#[test] #[test]
#[serial] #[serial]
fn given_a_hierachy_of_trusted_directories_nested_ones_should_overwrite_variables_from_parent_directories( fn given_a_hierarchy_of_trusted_directories_nested_ones_should_overwrite_variables_from_parent_directories(
) { ) {
Playground::setup("autoenv_test_10", |dirs, sandbox| { Playground::setup("autoenv_test_10", |dirs, sandbox| {
sandbox.mkdir("nu_plugin_rb"); sandbox.mkdir("nu_plugin_rb");
@ -401,7 +401,7 @@ fn local_config_should_not_be_added_when_running_scripts() {
} }
#[test] #[test]
#[serial] #[serial]
fn given_a_hierachy_of_trusted_directories_going_back_restores_overwritten_variables() { fn given_a_hierarchy_of_trusted_directories_going_back_restores_overwritten_variables() {
Playground::setup("autoenv_test_11", |dirs, sandbox| { Playground::setup("autoenv_test_11", |dirs, sandbox| {
sandbox.mkdir("nu_plugin_rb"); sandbox.mkdir("nu_plugin_rb");
sandbox.with_files(vec![ sandbox.with_files(vec![

View File

@ -413,7 +413,7 @@
<!-- <!--
Uncomment the next `WixVaraible` tag to customize the installer's Uncomment the next `WixVariable` tag to customize the installer's
Graphical User Interface (GUI) and add a custom banner image across Graphical User Interface (GUI) and add a custom banner image across
the top of each screen. See the WiX Toolset documentation for details the top of each screen. See the WiX Toolset documentation for details
about customization. about customization.