mirror of
https://github.com/LemmyNet/lemmy
synced 2024-11-10 06:54:12 +00:00
reorder, add test
This commit is contained in:
parent
6c6f7c6dff
commit
f43996880e
1 changed files with 13 additions and 6 deletions
|
@ -40,12 +40,19 @@ pub fn application_question_check(
|
|||
}
|
||||
}
|
||||
|
||||
fn not_zero(val: Option<i32>) -> Option<i32> {
|
||||
match val {
|
||||
Some(0) => None,
|
||||
v => v,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(clippy::unwrap_used)]
|
||||
#[allow(clippy::indexing_slicing)]
|
||||
mod tests {
|
||||
|
||||
use crate::site::{application_question_check, site_default_post_listing_type_check};
|
||||
use crate::site::{application_question_check, not_zero, site_default_post_listing_type_check};
|
||||
use lemmy_db_schema::{ListingType, RegistrationMode};
|
||||
|
||||
#[test]
|
||||
|
@ -93,11 +100,11 @@ mod tests {
|
|||
RegistrationMode::RequireApplication
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn not_zero(val: Option<i32>) -> Option<i32> {
|
||||
match val {
|
||||
Some(0) => None,
|
||||
v => v,
|
||||
#[test]
|
||||
fn test_not_zero() {
|
||||
assert_eq!(None, not_zero(None));
|
||||
assert_eq!(None, not_zero(Some(0)));
|
||||
assert_eq!(Some(5), not_zero(Some(5)));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue