diff --git a/CHANGELOG.md b/CHANGELOG.md index f9f2ad4..6a9845b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ ### Fixed +- Lot of typo in code + ## [0.21.0] 2024/6/1 ### Changed diff --git a/rstest/tests/fixture/mod.rs b/rstest/tests/fixture/mod.rs index c8b691a..f331ca9 100644 --- a/rstest/tests/fixture/mod.rs +++ b/rstest/tests/fixture/mod.rs @@ -216,9 +216,9 @@ mod should { // Just to see the errors if fixture doesn't compile assert_in!(output.stderr.str(), "Exec fixture() just once"); - let occurences = output.stderr.str().count("Exec fixture() just once"); + let occurrences = output.stderr.str().count("Exec fixture() just once"); - assert_eq!(1, occurences); + assert_eq!(1, occurrences); } mod show_correct_errors { diff --git a/rstest/tests/resources/rstest/use_mutable_fixture_in_parametric_argumnts.rs b/rstest/tests/resources/rstest/use_mutable_fixture_in_parametric_arguments.rs similarity index 100% rename from rstest/tests/resources/rstest/use_mutable_fixture_in_parametric_argumnts.rs rename to rstest/tests/resources/rstest/use_mutable_fixture_in_parametric_arguments.rs diff --git a/rstest/tests/rstest/mod.rs b/rstest/tests/rstest/mod.rs index 1dcb315..e4b44c3 100644 --- a/rstest/tests/rstest/mod.rs +++ b/rstest/tests/rstest/mod.rs @@ -165,8 +165,8 @@ fn impl_input() { } #[test] -fn use_mutable_fixture_in_parametric_argumnts() { - let (output, _) = run_test("use_mutable_fixture_in_parametric_argumnts.rs"); +fn use_mutable_fixture_in_parametric_arguments() { + let (output, _) = run_test("use_mutable_fixture_in_parametric_arguments.rs"); TestResults::new() .with_contains(true) diff --git a/rstest_macros/src/error.rs b/rstest_macros/src/error.rs index 78db9f9..74fac8b 100644 --- a/rstest_macros/src/error.rs +++ b/rstest_macros/src/error.rs @@ -301,7 +301,7 @@ mod test { #[case::const_generics("fn f(){}")] #[case::lifetimes("fn f<'a>(){}")] #[case::use_impl_in_answer("fn f() -> impl Iterator{}")] - #[case::use_impl_in_argumets("fn f(it: impl Iterator){}")] + #[case::use_impl_in_arguments("fn f(it: impl Iterator){}")] #[should_panic] #[case::sanity_check_with_no_generics("fn f() {}")] fn generics_once_should_return_error(#[case] f: &str) { @@ -323,7 +323,7 @@ mod test { #[case::const_generics("fn f(){}")] #[case::lifetimes("fn f<'a>(){}")] #[case::use_impl_in_answer("fn f() -> impl Iterator{}")] - #[case::use_impl_in_argumets("fn f(it: impl Iterator){}")] + #[case::use_impl_in_arguments("fn f(it: impl Iterator){}")] fn generics_once_should_not_return_if_no_once(#[case] f: &str) { let f: ItemFn = f.ast(); let info = FixtureInfo::default(); diff --git a/rstest_macros/src/parse/fixture.rs b/rstest_macros/src/parse/fixture.rs index ad810d8..70fe201 100644 --- a/rstest_macros/src/parse/fixture.rs +++ b/rstest_macros/src/parse/fixture.rs @@ -122,7 +122,7 @@ fn parse_attribute_args_just_once<'a, T: Parse>( } /// Simple struct used to visit function attributes and extract Fixtures and -/// eventualy parsing errors +/// eventually parsing errors #[derive(Default)] pub(crate) struct FixturesFunctionExtractor(pub(crate) Vec, pub(crate) Vec); diff --git a/rstest_macros/src/parse/rstest.rs b/rstest_macros/src/parse/rstest.rs index d058cb1..4ee2dea 100644 --- a/rstest_macros/src/parse/rstest.rs +++ b/rstest_macros/src/parse/rstest.rs @@ -522,7 +522,7 @@ mod test { } #[test] - fn extract_notrace_args_atttribute() { + fn extract_notrace_args_attribute() { let mut item_fn = r#" fn test_fn(#[notrace] a: u32, #[something_else] b: &str, #[notrace] c: i32) { } diff --git a/rstest_macros/src/render/apply_argumets.rs b/rstest_macros/src/render/apply_arguments.rs similarity index 92% rename from rstest_macros/src/render/apply_argumets.rs rename to rstest_macros/src/render/apply_arguments.rs index ff1f754..715e3a6 100644 --- a/rstest_macros/src/render/apply_argumets.rs +++ b/rstest_macros/src/render/apply_arguments.rs @@ -10,7 +10,7 @@ pub(crate) trait ApplyArguments { type Output: Sized; type Context; - fn apply_argumets( + fn apply_arguments( &mut self, arguments: &mut ArgumentsInfo, ctx: &mut Self::Context, @@ -21,7 +21,7 @@ impl ApplyArguments for FnArg { type Output = Option; type Context = usize; - fn apply_argumets( + fn apply_arguments( &mut self, arguments: &mut ArgumentsInfo, anoymous_id: &mut usize, @@ -60,12 +60,12 @@ impl ApplyArguments for Signature { type Output = (); type Context = (); - fn apply_argumets(&mut self, arguments: &mut ArgumentsInfo, _: &mut ()) { + fn apply_arguments(&mut self, arguments: &mut ArgumentsInfo, _: &mut ()) { let mut anonymous_lt = 0_usize; let new_lifetimes = self .inputs .iter_mut() - .filter_map(|arg| arg.apply_argumets(arguments, &mut anonymous_lt)) + .filter_map(|arg| arg.apply_arguments(arguments, &mut anonymous_lt)) .collect::>(); if !new_lifetimes.is_empty() || !self.generics.params.is_empty() { let new_generics = @@ -79,9 +79,9 @@ impl ApplyArguments for ItemFn { type Output = (); type Context = (); - fn apply_argumets(&mut self, arguments: &mut ArgumentsInfo, _: &mut ()) { + fn apply_arguments(&mut self, arguments: &mut ArgumentsInfo, _: &mut ()) { let args = self.sig.inputs.iter().cloned().collect::>(); - self.sig.apply_argumets(arguments, &mut ()); + self.sig.apply_arguments(arguments, &mut ()); let rebound_awaited_args = args .iter() .filter_map(MaybePat::maybe_pat) @@ -157,7 +157,7 @@ mod should { let orig = item_fn.clone(); let mut args = ArgumentsInfo::default(); - item_fn.sig.apply_argumets(&mut args, &mut ()); + item_fn.sig.apply_arguments(&mut args, &mut ()); assert_eq!(orig, item_fn) } @@ -204,7 +204,7 @@ mod should { .into_iter() .for_each(|&f| arguments.add_future(pat(f))); - item_fn.sig.apply_argumets(&mut arguments, &mut ()); + item_fn.sig.apply_arguments(&mut arguments, &mut ()); assert_eq!(expected, item_fn) } @@ -238,7 +238,7 @@ mod should { .into_iter() .for_each(|&f| arguments.add_future(pat(f))); - item_fn.sig.apply_argumets(&mut arguments, &mut ()); + item_fn.sig.apply_arguments(&mut arguments, &mut ()); assert_eq!(expected, item_fn) } @@ -258,7 +258,7 @@ mod should { arguments.add_future(pat("a")); arguments.add_future(pat("b")); - item_fn.apply_argumets(&mut arguments, &mut ()); + item_fn.apply_arguments(&mut arguments, &mut ()); let code = item_fn.block.display_code(); @@ -274,7 +274,7 @@ mod should { arguments.set_future(pat("a"), FutureArg::Define); arguments.set_future(pat("b"), FutureArg::Await); - item_fn.apply_argumets(&mut arguments, &mut ()); + item_fn.apply_arguments(&mut arguments, &mut ()); let code = item_fn.block.display_code(); @@ -290,7 +290,7 @@ mod should { arguments.set_future(pat("a").with_mut(), FutureArg::Await); - item_fn.apply_argumets(&mut arguments, &mut ()); + item_fn.apply_arguments(&mut arguments, &mut ()); let code = item_fn.block.display_code(); assert_in!(code, mut_await_argument_code_string("a")); diff --git a/rstest_macros/src/render/fixture.rs b/rstest_macros/src/render/fixture.rs index 206d002..74451a8 100644 --- a/rstest_macros/src/render/fixture.rs +++ b/rstest_macros/src/render/fixture.rs @@ -4,7 +4,7 @@ use syn::{parse_quote, FnArg, Generics, Ident, ItemFn, ReturnType}; use quote::quote; -use super::apply_argumets::ApplyArguments; +use super::apply_arguments::ApplyArguments; use super::{inject, render_exec_call}; use crate::refident::MaybeIdent; use crate::resolver::{self, Resolver}; @@ -35,7 +35,7 @@ fn wrap_call_impl_with_call_once_impl(call_impl: TokenStream, rt: &ReturnType) - pub(crate) fn render(mut fixture: ItemFn, info: FixtureInfo) -> TokenStream { let mut arguments = info.arguments.clone(); - fixture.apply_argumets(&mut arguments, &mut ()); + fixture.apply_arguments(&mut arguments, &mut ()); let name = &fixture.sig.ident; let asyncness = &fixture.sig.asyncness.clone(); let inner_args = info @@ -68,7 +68,7 @@ pub(crate) fn render(mut fixture: ItemFn, info: FixtureInfo) -> TokenStream { .map(|tp| &tp.ident) .cloned() .collect::>(); - let inject = inject::resolve_aruments(inner_args.iter(), &resolver, &generics_idents); + let inject = inject::resolve_arguments(inner_args.iter(), &resolver, &generics_idents); let partials = (1..=inner_args.len()).map(|n| { render_partial_impl( @@ -144,7 +144,7 @@ fn render_partial_impl( .map(|tp| &tp.ident) .cloned() .collect::>(); - let inject = inject::resolve_aruments(args.iter().skip(n), resolver, &genercs_idents); + let inject = inject::resolve_arguments(args.iter().skip(n), resolver, &genercs_idents); let sign_args = args.iter().take(n); let fixture_args = args @@ -314,8 +314,8 @@ mod should { )); let body = select_method(out.core_impl, method).unwrap().block; - let last_statment = body.stmts.last().unwrap(); - let is_await = match last_statment { + let last_statement = body.stmts.last().unwrap(); + let is_await = match last_statement { syn::Stmt::Expr(syn::Expr::Await(_), _) => true, _ => false, }; diff --git a/rstest_macros/src/render/inject.rs b/rstest_macros/src/render/inject.rs index 7d5a050..d3946f0 100644 --- a/rstest_macros/src/render/inject.rs +++ b/rstest_macros/src/render/inject.rs @@ -11,7 +11,7 @@ use crate::{ utils::{fn_arg_mutability, IsLiteralExpression}, }; -pub(crate) fn resolve_aruments<'a>( +pub(crate) fn resolve_arguments<'a>( args: impl Iterator, resolver: &impl Resolver, generic_types: &[Ident], @@ -145,7 +145,7 @@ mod should { #[rstest] #[case::as_is("fix: String", ("fix", expr("bar()")), "let fix = bar();")] #[case::with_allow_unused_mut("mut fix: String", ("fix", expr("bar()")), "#[allow(unused_mut)] let mut fix = bar();")] - #[case::without_undescore("_fix: String", ("fix", expr("bar()")), "let _fix = bar();")] + #[case::without_underscore("_fix: String", ("fix", expr("bar()")), "let _fix = bar();")] #[case::without_remove_underscore_if_value("_orig: S", ("_orig", expr("S{}")), r#"let _orig = S{};"#)] fn call_given_fixture( #[case] arg_str: &str, diff --git a/rstest_macros/src/render/mod.rs b/rstest_macros/src/render/mod.rs index f6bfe6f..275abef 100644 --- a/rstest_macros/src/render/mod.rs +++ b/rstest_macros/src/render/mod.rs @@ -30,13 +30,13 @@ use wrapper::WrapByModule; pub(crate) use fixture::render as fixture; -use self::apply_argumets::ApplyArguments; +use self::apply_arguments::ApplyArguments; use self::crate_resolver::crate_name; -pub(crate) mod apply_argumets; +pub(crate) mod apply_arguments; pub(crate) mod inject; pub(crate) fn single(mut test: ItemFn, mut info: RsTestInfo) -> TokenStream { - test.apply_argumets(&mut info.arguments, &mut ()); + test.apply_arguments(&mut info.arguments, &mut ()); let resolver = resolver::fixtures::get(&info.arguments, info.data.fixtures()); @@ -60,7 +60,7 @@ pub(crate) fn single(mut test: ItemFn, mut info: RsTestInfo) -> TokenStream { pub(crate) fn parametrize(mut test: ItemFn, info: RsTestInfo) -> TokenStream { let mut arguments_info = info.arguments.clone(); - test.apply_argumets(&mut arguments_info, &mut ()); + test.apply_arguments(&mut arguments_info, &mut ()); let resolver_fixtures = resolver::fixtures::get(&info.arguments, info.data.fixtures()); @@ -154,7 +154,7 @@ fn _matrix_recursive<'a>( } pub(crate) fn matrix(mut test: ItemFn, mut info: RsTestInfo) -> TokenStream { - test.apply_argumets(&mut info.arguments, &mut ()); + test.apply_arguments(&mut info.arguments, &mut ()); let span = test.sig.ident.span(); let cases = cases_data(&info, span).collect::>(); @@ -274,7 +274,7 @@ fn single_test_case( None => true, }); - let inject = inject::resolve_aruments(injectable_args.into_iter(), &resolver, &generics_types); + let inject = inject::resolve_arguments(injectable_args.into_iter(), &resolver, &generics_types); let args = args .iter() @@ -292,7 +292,7 @@ fn single_test_case( .last() .map(|attribute| attribute.parse_args::().unwrap()); - // If no injected attribut provided use the default one + // If no injected attribute provided use the default one let test_attr = if attrs .iter() .any(|a| attr_ends_with(a, &parse_quote! {test})) diff --git a/rstest_macros/src/render/test.rs b/rstest_macros/src/render/test.rs index 8df59a0..f408675 100644 --- a/rstest_macros/src/render/test.rs +++ b/rstest_macros/src/render/test.rs @@ -27,10 +27,10 @@ impl SetAsync for ItemFn { fn trace_argument_code_string(arg_name: &str) -> String { let arg_name = ident(arg_name); - let statment: Stmt = parse_quote! { + let statement: Stmt = parse_quote! { println!("{} = {:?}", stringify!(#arg_name) ,#arg_name); }; - statment.display_code() + statement.display_code() } mod single_test_should { @@ -1289,12 +1289,12 @@ mod matrix_cases_should { assert!(tests.len() > 0); for test in tests { - let filterd: Vec<_> = test + let filtered: Vec<_> = test .attrs .into_iter() .filter(|a| !filter.contains(a)) .collect(); - assert_eq!(attributes, filterd); + assert_eq!(attributes, filtered); } } diff --git a/rstest_macros/src/test.rs b/rstest_macros/src/test.rs index de630ce..672c5c5 100644 --- a/rstest_macros/src/test.rs +++ b/rstest_macros/src/test.rs @@ -357,24 +357,24 @@ impl crate::parse::fixture::FixtureInfo { pub(crate) fn await_argument_code_string(arg_name: &str) -> String { let arg_name = ident(arg_name); - let statment: Stmt = parse_quote! { + let statement: Stmt = parse_quote! { let #arg_name = #arg_name.await; }; - statment.display_code() + statement.display_code() } pub(crate) fn ref_argument_code_string(arg_name: &str) -> String { let arg_name = ident(arg_name); - let statment: Expr = parse_quote! { + let statement: Expr = parse_quote! { &#arg_name }; - statment.display_code() + statement.display_code() } pub(crate) fn mut_await_argument_code_string(arg_name: &str) -> String { let arg_name = ident(arg_name); - let statment: Stmt = parse_quote! { + let statement: Stmt = parse_quote! { let mut #arg_name = #arg_name.await; }; - statment.display_code() + statement.display_code() } diff --git a/rstest_macros/src/utils.rs b/rstest_macros/src/utils.rs index d78a9d5..e97da22 100644 --- a/rstest_macros/src/utils.rs +++ b/rstest_macros/src/utils.rs @@ -84,8 +84,8 @@ fn _is_used( return true; } if references.contains_key(id) { - for refered in references.get(id).unwrap() { - if _is_used(visited, refered, references, ends) { + for referred in references.get(id).unwrap() { + if _is_used(visited, referred, references, ends) { return true; } } @@ -306,7 +306,7 @@ mod test { #[test] fn fn_args_has_pat_should() { let item_fn = parse_quote! { - fn the_functon(first: u32, second: u32) {} + fn the_function(first: u32, second: u32) {} }; assert!(fn_args_has_pat(&item_fn, &pat("first"))); diff --git a/rstest_reuse/README.md b/rstest_reuse/README.md index 99ee304..dd797c9 100644 --- a/rstest_reuse/README.md +++ b/rstest_reuse/README.md @@ -180,7 +180,7 @@ pub use rstest_reuse; And not just `use rstest_reuse` like in the standard cases. -## Disclamer +## Disclaimer This crate is in a development stage. I don't know if I'll include it in `rstest` or change some syntax in the future. diff --git a/rstest_reuse/src/lib.rs b/rstest_reuse/src/lib.rs index 91d60d3..f7489f6 100644 --- a/rstest_reuse/src/lib.rs +++ b/rstest_reuse/src/lib.rs @@ -84,7 +84,7 @@ //! Simple and neat! //! //! Note that if the test arguments names match the template's ones you can don't -//! repeate the arguments attributes. +//! repeat the arguments attributes. //! //! ## Composition and Values //! @@ -179,9 +179,9 @@ //! ``` //! use rstest_reuse::*; //! ``` -//! is not enougth: this statment doesn't include `rstest_reuse` but just its public items. +//! is not enough: this statement doesn't include `rstest_reuse` but just its public items. //! -//! ## Disclamer +//! ## Disclaimer //! //! This crate is in developer stage. I don't know if I'll include it in `rstest` or changing some syntax in //! the future. diff --git a/rstest_test/src/utils.rs b/rstest_test/src/utils.rs index fbb0d30..ac5cd9b 100644 --- a/rstest_test/src/utils.rs +++ b/rstest_test/src/utils.rs @@ -155,22 +155,22 @@ impl> TestResult { } } - fn ok(name: S, exactly: bool, occurence: usize) -> Self { + fn ok(name: S, exactly: bool, occurrence: usize) -> Self { Self::Ok( name, TestInfo { exactly, - times: occurence, + times: occurrence, }, ) } - fn fail(name: S, exactly: bool, occurence: usize) -> Self { + fn fail(name: S, exactly: bool, occurrence: usize) -> Self { Self::Fail( name, TestInfo { exactly, - times: occurence, + times: occurrence, }, ) } @@ -245,12 +245,12 @@ where } } - pub fn ok_with(self, name: S, exactly: bool, occurence: usize) -> Self { - self.append(TestResult::ok(name, exactly, occurence)) + pub fn ok_with(self, name: S, exactly: bool, occurrence: usize) -> Self { + self.append(TestResult::ok(name, exactly, occurrence)) } - pub fn fail_with(self, name: S, exactly: bool, occurence: usize) -> Self { - self.append(TestResult::fail(name, exactly, occurence)) + pub fn fail_with(self, name: S, exactly: bool, occurrence: usize) -> Self { + self.append(TestResult::fail(name, exactly, occurrence)) } pub fn ok(self, name: S) -> Self { @@ -271,14 +271,14 @@ where self.fail_with(name, false, 1) } - pub fn ok_times(self, name: S, occurence: usize) -> Self { + pub fn ok_times(self, name: S, occurrence: usize) -> Self { let contains = self.contains; - self.ok_with(name, !contains, occurence) + self.ok_with(name, !contains, occurrence) } - pub fn fail_times(self, name: S, occurence: usize) -> Self { + pub fn fail_times(self, name: S, occurrence: usize) -> Self { let contains = self.contains; - self.fail_with(name, !contains, occurence) + self.fail_with(name, !contains, occurrence) } pub(crate) fn append(mut self, test: TestResult) -> Self { @@ -381,8 +381,8 @@ mod test { use super::*; #[test] - fn should_count_message_occurence() { - let foo_occurences = " + fn should_count_message_occurrence() { + let foo_occurrences = " foobaz bar foobazfoo @@ -391,11 +391,11 @@ mod test { " .count("foo"); - assert_eq!(3, foo_occurences); + assert_eq!(3, foo_occurrences); } #[test] - fn should_count_regex_occurence() { + fn should_count_regex_occurrence() { let message = " 123 aa2bb