Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
la10736 committed Aug 4, 2024
1 parent 696eaf6 commit 9110f0c
Show file tree
Hide file tree
Showing 17 changed files with 70 additions and 68 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

### Fixed

- Lot of typo in code

## [0.21.0] 2024/6/1

### Changed
Expand Down
4 changes: 2 additions & 2 deletions rstest/tests/fixture/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions rstest/tests/rstest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions rstest_macros/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ mod test {
#[case::const_generics("fn f<const N: usize>(){}")]
#[case::lifetimes("fn f<'a>(){}")]
#[case::use_impl_in_answer("fn f() -> impl Iterator<Item=u32>{}")]
#[case::use_impl_in_argumets("fn f(it: impl Iterator<Item=u32>){}")]
#[case::use_impl_in_arguments("fn f(it: impl Iterator<Item=u32>){}")]
#[should_panic]
#[case::sanity_check_with_no_generics("fn f() {}")]
fn generics_once_should_return_error(#[case] f: &str) {
Expand All @@ -323,7 +323,7 @@ mod test {
#[case::const_generics("fn f<const N: usize>(){}")]
#[case::lifetimes("fn f<'a>(){}")]
#[case::use_impl_in_answer("fn f() -> impl Iterator<Item=u32>{}")]
#[case::use_impl_in_argumets("fn f(it: impl Iterator<Item=u32>){}")]
#[case::use_impl_in_arguments("fn f(it: impl Iterator<Item=u32>){}")]
fn generics_once_should_not_return_if_no_once(#[case] f: &str) {
let f: ItemFn = f.ast();
let info = FixtureInfo::default();
Expand Down
2 changes: 1 addition & 1 deletion rstest_macros/src/parse/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Fixture>, pub(crate) Vec<syn::Error>);

Expand Down
2 changes: 1 addition & 1 deletion rstest_macros/src/parse/rstest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -21,7 +21,7 @@ impl ApplyArguments for FnArg {
type Output = Option<Lifetime>;
type Context = usize;

fn apply_argumets(
fn apply_arguments(
&mut self,
arguments: &mut ArgumentsInfo,
anoymous_id: &mut usize,
Expand Down Expand Up @@ -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::<Vec<_>>();
if !new_lifetimes.is_empty() || !self.generics.params.is_empty() {
let new_generics =
Expand All @@ -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::<Vec<_>>();
self.sig.apply_argumets(arguments, &mut ());
self.sig.apply_arguments(arguments, &mut ());
let rebound_awaited_args = args
.iter()
.filter_map(MaybePat::maybe_pat)
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand All @@ -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();

Expand All @@ -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();

Expand All @@ -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"));
Expand Down
12 changes: 6 additions & 6 deletions rstest_macros/src/render/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -68,7 +68,7 @@ pub(crate) fn render(mut fixture: ItemFn, info: FixtureInfo) -> TokenStream {
.map(|tp| &tp.ident)
.cloned()
.collect::<Vec<_>>();
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(
Expand Down Expand Up @@ -144,7 +144,7 @@ fn render_partial_impl(
.map(|tp| &tp.ident)
.cloned()
.collect::<Vec<_>>();
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
Expand Down Expand Up @@ -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,
};
Expand Down
4 changes: 2 additions & 2 deletions rstest_macros/src/render/inject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Item = &'a FnArg>,
resolver: &impl Resolver,
generic_types: &[Ident],
Expand Down Expand Up @@ -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,
Expand Down
14 changes: 7 additions & 7 deletions rstest_macros/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand All @@ -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());

Expand Down Expand Up @@ -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::<Vec<_>>();
Expand Down Expand Up @@ -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()
Expand All @@ -292,7 +292,7 @@ fn single_test_case(
.last()
.map(|attribute| attribute.parse_args::<Expr>().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}))
Expand Down
8 changes: 4 additions & 4 deletions rstest_macros/src/render/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}
}

Expand Down
12 changes: 6 additions & 6 deletions rstest_macros/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
6 changes: 3 additions & 3 deletions rstest_macros/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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")));
Expand Down
2 changes: 1 addition & 1 deletion rstest_reuse/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
6 changes: 3 additions & 3 deletions rstest_reuse/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
//!
Expand Down Expand Up @@ -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.
Expand Down
Loading

0 comments on commit 9110f0c

Please sign in to comment.