Skip to content

Commit

Permalink
chore: fix clippy and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-biel committed Sep 16, 2023
1 parent ada5d82 commit f202f47
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion crates/test-case-core/src/test_case.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl TestCase {
.expression
.as_ref()
.map(|expr| expr.attributes())
.unwrap_or_else(Vec::new);
.unwrap_or_default();

attrs.push(parse_quote! { #[allow(clippy::bool_assert_comparison)] });
attrs.append(&mut item.attrs);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
source: tests/acceptance_tests.rs
assertion_line: 78
expression: output
---
internal_tested_function1::_3_expects_6
left: `6`,
right: `0`', src/lib.rs:8:1
right: `0`
---- internal_tested_function1::_3_expects_6 stdout ----
assertion failed: `(left == right)`
error: test failed, to rerun pass `--lib`
failures:
failures:
Expand All @@ -18,4 +18,4 @@ test internal_tested_function3::_1_expects_matching_3_ ... ok
test internal_tested_function3::_2_expects_inconclusive6 ... ignored
test internal_tested_function4::_2_expects_panicking_some_can_t_ - should panic ... ok
test result: FAILED. 4 passed; 1 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s
thread 'internal_tested_function1::_3_expects_6' panicked at 'assertion failed: `(left == right)`
thread 'internal_tested_function1::_3_expects_6' panicked at src/lib.rs:8:1:
4 changes: 2 additions & 2 deletions tests/snapshots/rust-nightly/acceptance__cases_can_panic.snap
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
source: tests/acceptance_tests.rs
assertion_line: 93
expression: output
---
panic message: `"It has to panic"`,
panicing::_expects_panicking_some_this_should_fail_
expected substring: `"This should fail"`
---- panicing::_expects_panicking_some_this_should_fail_ stdout ----
It has to panic
error: test failed, to rerun pass `--lib`
failures:
failures:
Expand All @@ -17,4 +17,4 @@ test panics_without_value::_expects_panicking_none - should panic ... ok
test pattern_matching_result_fails::simpleenum_var1_expects_matching_simpleenum_var2_ - should panic ... ok
test result: FAILED. 4 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result_which_panics::_2_2_expects_2_3 - should panic ... ok
thread 'panicing::_expects_panicking_some_this_should_fail_' panicked at 'It has to panic', src/lib.rs:20:5
thread 'panicing::_expects_panicking_some_this_should_fail_' panicked at src/lib.rs:20:5:
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
---
source: tests/acceptance_tests.rs
assertion_line: 138
expression: output
---
/
^
regex_test::_abcabc201_expects_complex_regex_r_d_4_
regex_test::_kumkwat_expects_complex_regex_r_
regex_test::_kumkwat_expects_complex_regex_r_abc_
)', src/lib.rs:5:1
)
---- regex_test::_abcabc201_expects_complex_regex_r_d_4_ stdout ----
---- regex_test::_kumkwat_expects_complex_regex_r_ stdout ----
---- regex_test::_kumkwat_expects_complex_regex_r_abc_ stdout ----
Regex::new: Syntax(
assertion failed: {/n let re = ::test_case::Regex::new(r#/"//d{4}/"#).expect(/"Regex::new/");/n re.is_match(_result)/n}
assertion failed: {/n let re = ::test_case::Regex::new(r#/"abc/"#).expect(/"Regex::new/");/n re.is_match(_result)/n}
error: incomplete escape sequence, reached end of pattern prematurely
error: test failed, to rerun pass `--lib`
failures:
Expand All @@ -25,8 +27,8 @@ test regex_test::_kumkwat_expects_complex_regex_r_ ... FAILED
test regex_test::_kumkwat_expects_complex_regex_r_abc_ ... FAILED
test regex_test::_kumkwat_expects_complex_regex_r_kumkwat_ ... ok
test result: FAILED. 3 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
thread 'regex_test::_abcabc201_expects_complex_regex_r_d_4_' panicked at 'assertion failed: {/n let re = ::test_case::Regex::new(r#/"//d{4}/"#).expect(/"Regex::new/");/n re.is_match(_result)/n}', src/lib.rs:5:1
thread 'regex_test::_kumkwat_expects_complex_regex_r_' panicked at 'Regex::new: Syntax(
thread 'regex_test::_kumkwat_expects_complex_regex_r_abc_' panicked at 'assertion failed: {/n let re = ::test_case::Regex::new(r#/"abc/"#).expect(/"Regex::new/");/n re.is_match(_result)/n}', src/lib.rs:5:1
thread 'regex_test::_abcabc201_expects_complex_regex_r_d_4_' panicked at src/lib.rs:5:1:
thread 'regex_test::_kumkwat_expects_complex_regex_r_' panicked at src/lib.rs:5:1:
thread 'regex_test::_kumkwat_expects_complex_regex_r_abc_' panicked at src/lib.rs:5:1:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
source: tests/acceptance_tests.rs
assertion_line: 75
expression: output
---
Running `target/debug/cases_can_be_declared_on_non_test_items`
thread 'main' panicked at 'Can't', src/lib.rs:33:5
Can't
thread 'main' panicked at src/lib.rs:33:5:
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
source: tests/acceptance_tests.rs
assertion_line: 108
expression: output
---
empty::vec_0_expects_complex_empty
---- empty::vec_0_expects_complex_empty stdout ----
assertion failed: _result.is_empty()
error: test failed, to rerun pass `--lib`
failures:
failures:
Expand Down Expand Up @@ -64,4 +64,4 @@ test not_path::_cargo_toml_parse_unwrap_expects_complex_not_path_dir ... ok
test not_path::_cargo_yaml_parse_unwrap_expects_complex_not_path_path ... ok
test not_path::_src_parse_unwrap_expects_complex_not_path_file ... ok
test result: FAILED. 53 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
thread 'empty::vec_0_expects_complex_empty' panicked at 'assertion failed: _result.is_empty()', src/lib.rs:115:1
thread 'empty::vec_0_expects_complex_empty' panicked at src/lib.rs:115:1:
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
source: tests/acceptance_tests.rs
assertion_line: 133
expression: output
---
extended_pattern_matching_result::err_should_fail
extended_pattern_matching_result::ok_should_fail
---- extended_pattern_matching_result::err_should_fail stdout ----
---- extended_pattern_matching_result::ok_should_fail stdout ----
Expected `Err(e) if e == "var1"` found Err("var2")
Expected `Ok(e) if e == SimpleEnum :: Var2` found Ok(Var1)
error: test failed, to rerun pass `--lib`
failures:
failures:
Expand All @@ -17,5 +18,5 @@ test extended_pattern_matching_result::simpleenum_var1_expects_matching_ok_e_e_s
test extended_pattern_matching_result::simpleenum_var2_expects_matching_err_e_e_var2_ ... ok
test pattern_matching_result::simpleenum_var2_expects_matching_simpleenum_var2_ ... ok
test result: FAILED. 3 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
thread 'extended_pattern_matching_result::err_should_fail' panicked at 'Expected `Err(e) if e == "var1"` found Err("var2")', src/lib.rs:16:1
thread 'extended_pattern_matching_result::ok_should_fail' panicked at 'Expected `Ok(e) if e == SimpleEnum :: Var2` found Ok(Var1)', src/lib.rs:16:1
thread 'extended_pattern_matching_result::err_should_fail' panicked at src/lib.rs:16:1:
thread 'extended_pattern_matching_result::ok_should_fail' panicked at src/lib.rs:16:1:

0 comments on commit f202f47

Please sign in to comment.