You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: forc-pkg/src/pkg.rs
+11-11Lines changed: 11 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -2046,17 +2046,17 @@ impl PkgTestEntry {
2046
2046
2047
2047
// With fixture-based testing, #[test] is mandatory and can coexist with #[fuzz] and #[case]
2048
2048
let has_case = test_function_decl.attributes.cases().next().is_some();
2049
-
match(test_attr, fuzz_attr, has_case){
2050
-
(None,Some(_), _) | (None,None,true) => {
2051
-
bail!(
2052
-
"Function \"{}\" has parameterization attributes (#[fuzz] or #[case]) but is missing the required #[test] attribute",
2053
-
test_function_decl.name
2054
-
);
2055
-
}
2056
-
(None,None,false) => {
2057
-
unreachable!("`test_function_decl` is guaranteed to be a test or fuzz function and it must have a `#[test]` attribute or parameterization attributes");
2058
-
}
2059
-
_ => {}// Valid: #[test] is present or only #[test] is present
2049
+
let has_parameterization = fuzz_attr.is_some() || has_case;
2050
+
2051
+
if test_attr.is_none() && has_parameterization {
2052
+
bail!(
2053
+
"Function \"{}\" has parameterization attributes (#[fuzz] or #[case]) but is missing the required #[test] attribute",
2054
+
test_function_decl.name
2055
+
);
2056
+
}
2057
+
2058
+
if test_attr.is_none() && !has_parameterization {
2059
+
unreachable!("`test_function_decl` is guaranteed to be a test or fuzz function and it must have a `#[test]` attribute or parameterization attributes");
2060
2060
}
2061
2061
2062
2062
let pass_condition = ifletSome(test_attr) = test_attr {
0 commit comments